meteor-jade
meteor-jade copied to clipboard
pathFor does not work with obj properties
JS:
Template.nav.helpers({
navItems: function () {
return [
{
name: "Item1",
route: "Item1.show",
},
{
name: "Item2",
route: "Item2.show",
}]
}
});
nav.jade
template(name="nav")
ul.nav
each navItems
li.nav-item
a.nav-item-name(class=selected href=pathFor(route))= name
Error:
=> Errors prevented startup:
While building the application:
client/templates/nav.jade: Jade syntax error: Expected identifier, number,
string, boolean, or null
{{pathFor(route)}}
^
packages/compileJade/plugin/handler.js:xx:1: Cannot read property 'head' of
undefined (compiling client/templates/nav.jade) (at fileModeHandler)
I've modified a fork of this package to support passing arguments to attribute helpers, together with a few other useful features. The fork has been released as dalgard:jade
.
I will keep the new package in sync with the original, should there be any updates, and generally continue maintenance until, hopefully, the two packages can be merged.
+1
Just use a(href="{{pathFor route}}")
in your jade file.
this worked for me:
{{pathFor 'myTemplate'}}