I have an Ember App with Models for:
- Food
- Meals
(there are other Models but these are ommitted for the sake of brevity).
The router is configured thus:
this.resource('food', { path: '/food/:food_id' });
this.resource('meals',function() {
this.resource('meal', { path: '/:meal_id'}, function() {
this.route('edit');
});
this.route('new');
});
In my Food template I need access to the list of Meals in order to print them. Initially I thought of the needs
property on the FoodController
would do the trick.
App.FoodController = Ember.ObjectController.extend({
needs: ['meals', 'mealsIndex'],
...
});
In my template I then tried
{{#each meal in controllers.meals.content}}
TEST
{{/each}}
...but nothing is displayed. I've actually tried several other methods but nothing is having any effect.
I suspect that perhaps the the MealsController's Model isn't being set until the meals
route is entered.
I'm totally stuck here and the docs aren't helping. Any assistance much appreciated.