mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 00:19:48 +01:00
Fixed partials example
This commit is contained in:
parent
bd1ab7ab96
commit
d5b7a40b39
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Loading…
Reference in New Issue
Block a user