0
votes

I'm extremely new to ember.js and am hitting a wall. I'm using ember.js 1.0.0-pre4

My app.js has the following setup:

window.App = Ember.Application.create();

App.Router.map(function() {
    this.route("dashboard", {path: "/"});
});

App.DashboardRoute = Ember.Route.extend({
})

I tried doing something like this on the application template (Ember.TEMPLATES['application'])

{{#linkTo "dashboard"}}Dashboard{{/linkTo}}

And it gives me Uncaught Error: Could not find property 'linkTo'. I tried {{view}} as well as other helpers but all gave me the same could not find property error.

jsfiddle: http://jsfiddle.net/gBf42/

1
Your syntax is definitely correct so it is not that that is causing the error. Something else is interfering with your code. Do you reckon you could provide a jsfiddle with the reproduced error?DF_
@Deif Well something like this? jsfiddle.net/gBf42TheOnly92

1 Answers

3
votes

Aha, I found the problem! 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. One such template is the {{#linkTo ...}} template.

So to fix, all you have to do is use Ember.Handlebars instead:

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