0
votes

While trying to setup a jsfiddle for another question that I asked here on SO I encountered the following problem:
I try to load the "amounts" route that should render the "amounts" template via the {{linkTo}} helper in the "index" template. But when I click on the link I'm not beeing redirected to the "amounts" template, it just stays on the "index" template and does nothing (so I guess the "amounts" route isn't loaded too).
Handlebars Template:

<script type="text/x-handlebars" data-template-name="index">
<h1>Conversion</h1>
<label>Conversion Factor:</label>
{{view Ember.TextField valueBinding="conversionFactor"}}
{{#linkTo "amounts" }}Show Amounts{{/linkTo}} 
{{outlet}}
</script>

Router setup:

// Router
App.Router.map(function() {
this.resource('amounts', function() {
    this.route('new')
});
});

This is my first time with jsfiddle, so probably I misconfigured something.
I'm sure there's a simple reason why it doesn't work, but I couln't figure it out so far.
Here's the fiddle.
Any hint would be great! Thanks!

1

1 Answers

0
votes

First, setup LOG_TRANSITIONS in your Ember.Application.create call to look like this:

Ember.Application.create({
  LOG_TRANSITIONS: true  
})

and check out the console. This will give you more clues about what's going on. First off, I saw that you need to define an App.Store, or calls to model.find() won't work.

App.Store = DS.Store.extend({});

Latest version of ember-data doesn't have revision numbers anymore, but earlier versions will, so in that case, you'd have to provide a revision number.

Your amounts controller has a typo, so that it's probably also breaking the route. Uncaught ReferenceError: EmberArrayController is not defined

Here's an updated fiddle that makes this a working example. http://jsfiddle.net/Ttsmk/5/