I'm fairly new to Ember and I'm starting to write more complex apps. I've been pulling hair trying to figure out why defining a controller for the index breaks the index route's model population.
I've tried the "setupcontroller" function, but still no luck.
Here's the route code:
App.IndexRoute = Ember.Route.extend({
model: function () {
return Ember.RSVP.hash({ //return promises for both models here
featuredJobs: $.getJSON('http://api.*********/featured/jobs', {'token': guestToken}),
featuredEmployers: $.getJSON('http://api.********/featured/employers', {'token': guestToken})
})
}
});
When I add App.IndexController = Ember.Controller.extend({...
it breaks the model's {{#each}} helper. (not the app). I can see the model assigned to the route in the Ember inspector. Here's the template:
<div class="panel-body">
<div class="list-group ft-jobs">
{{#each featuredJobs}}
{{#linkTo 'job' _id class="list-group-item"}}
<h4 class="list-group-item-heading">{{title}}</h4>
<p class="list-group-item-text">{{description}}</p>
{{/linkTo}}
{{else}}
<p class="text-center">Sorry, no featured jobs are available.</p>
{{/each}} //END OF SNIPPET