Question

I'm using the ember-rails gem and following along with the starter screencast on the Emberjs.com site. When I create this link

 <li>{{#link-to 'about'}} About {{/link-to}}</li>

It's giving me this error

Uncaught Error:  Handlebars error: Could not find property 'link-to' on object <(generated application controller):ember280>. 

There's a StackOverflow question that deals with this issue Helpers not properly defined in application template?. One answer says that

When you use Handlebars.compile it uses the handlebars script instead of the Ember script. Ember has its own handlebars object that extends the original Handlebars object with extra templates.

and gives this example

Ember.TEMPLATES["application"] = Ember.Handlebars.compile("{{#linkTo 'dashboard'}}Dashboard{{/linkTo}}")

However, I'm unclear where to put that code, and would it need to be done for every link?

Était-ce utile?

La solution

I suspect you're running an older version of ember. Try running this to get the latest version of Ember into your app.

rails generate ember:install --head
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top