I ran into a very basic problem but I can\'t seem to find the answer to it. I am working with node.js
, express
and I am just trying to pass a local var
You should pass the variable without the locals
. This is probably new in express 3.0.0
res.render("index", {title: "Blog"});
Here is a response that I made few hours ago to a smiliar question (+ deal with layout). It shows how to pass data when rendering. (Express 3.0.0 complient)
h1 = title tries to evaluate it locally, the title you sent and that one is different. To understand the difference see:
- var title = 'my title' // - allows writing code
h1 = title
The one you should use is:
h1 #{title}