I have Jade template:
template(name="mainLayout")
h1= data
h3 Meteor.js Example
When I try to pass data to template in router:
Router.route "/", () ->
@render "index", data: "My Awesome Page"
This is not working. How to pass the data into template?
data
passed in the router is this
in the jade.
So instead of:
h1= data
Try:
h1= this
If you want to pass more data, you can do like this:
template(name="mainLayout")
h1= this.data1
h2= this.data2
// or shorted, just ignore the this.
h1= data1
h2= data2
h3 Meteor.js Example
Router.route "/", () ->
@render "index", data: { data1: "My Awesome Page", data2: "Foobar" }