Iterating over Objects in Ember handles bar
-
21-12-2019 - |
Question
I have created an Object in my ember App and have created some instances of it. Now I want to retrieve that data and display it in the handlesbar template. Is there any way of doing it?
Solution
I assume your structure is kind of this example
App.MyObject = Ember.Object.extend({
// some attributes
anyAttribute: DS.attr()
});
App.MyRoute = App.Route.extend({
model: function(){
// return your object array
}
});
In your template:
{{#each item in model}}
{{item.anyAttribute}}
{{/each}}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow