And I want to display the values that I’ve set on myRouteProperty on my index.hbs template. Something like this:
{{#each myRouteProperty as |property|}}
<h1>{{property.name}}</h1>
{{/each}}
But I can’t access myRouteProperty inside the index.hbs template, the value is empty. I’m not sure how to properly access the data from my route without a controller, I know that I have to set the data on the model, but if I do something like this:
In the Ember architecture, Routes aren’t actually connected to the template, Controllers are.
The job of a route is to set up the right template and controller, and then set the controller’s model property with the return value of the model() hook.
@locks, thanks for your help. Actually I’m a little confused about the controllers being deprecated and how to transition their logic to routes. That’s why I’ve put the query inside the action on my route. With that in mind, how would I do the query without a controller?
Controllers are not deprecated, and you should use them normally. What material are you consulting that says this, so we can try to address it? You can also reach us at #-team-learning in the Slack group if you prefer.
@locks, I’m sorry, I think I’ve used the wrong word. I know they are not deprecated, but I understand that it’s a good practice to avoid controllers in new applications because Ember.js team is changing the routable controllers to the routable components. So now I’m trying to use add-ons like ember-route-action-helper to send closure actions to the route. I think that now you can understand why my code is messy.
The solution that you pointed worked like a charm. Thank you! I’ll also check out the Slack group. =)