Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

pathFor does not work with obj properties #160

Open
ChrisCinelli opened this issue Jul 26, 2015 · 4 comments
Open

pathFor does not work with obj properties #160

ChrisCinelli opened this issue Jul 26, 2015 · 4 comments

Comments

@ChrisCinelli
Copy link

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)
@dalgard
Copy link

dalgard commented Oct 14, 2015

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.

@uinz
Copy link

uinz commented Dec 9, 2015

+1

@laurentpayot
Copy link

Just use a(href="{{pathFor route}}") in your jade file.

@takahser
Copy link

this worked for me:
{{pathFor 'myTemplate'}}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants