Reputation: 3
I am trying to pass some values in to a jade template through a node/express route but nothing is getting passed on. I am posting both the server and the template code.
server.js:
app.get('/note/:id',function(request,response) {
var title=notes[request.params.id]['title']
var message=notes[request.params.id]['message']
console.log(title+' '+message)
response.render('note', {locals:{title:title, message:message}})
});
note.jade:
span #{locals.title}
I even tried to display the locals array to console but it only throws up an error.
Upvotes: 0
Views: 438
Reputation: 10678
I believe you do not need to pass in the locals key. If I remember right that is only used inside the template. Give this a try.
response.render('note', {title:title, message:message})
and in your template don't use #{locals.title}
use #{title}
Did a quick test and this should work for you.
Upvotes: 0