Fixed partials example

This commit is contained in:
Tj Holowaychuk 2011-03-17 13:00:43 -07:00
parent bd1ab7ab96
commit d5b7a40b39
5 changed files with 7 additions and 8 deletions

View File

@ -28,13 +28,8 @@ var ninja = {
};
app.get('/', function(req, res){
res.render('ninjas', { ninja: ninja });
res.render('ninja', { ninja: ninja });
});
app.get('/li', function(req, res){
res.partial('li', { object: 'Testing', as: 'value' });
});
app.listen(3000);
console.log('Express app started on port 3000');

View File

@ -1,8 +1,12 @@
h1= ninja.name
// file, partial name, and partial object all match ('summary')
// the partial filename prefix '_' is completely optional
#summary!= partial('summary', ninja.summary)
// the partial filename prefix '_' is completely optional.
// In this case we need to specify ninja.summary as the object
// option, since it is a "plain" object Express cannot otherwise
// tell if it is intended to be locals, or THE summary object
#summary!= partial('summary', { object: ninja.summary })
// file, partial name = '_weapon', resolves to 'weapon' object within partial
#weapons