Reputation: 4050
In ember I have a Model like this
App.IndexRoute = Ember.Route.extend({
model: function() {
return {
model1: ['red', 'yellow', 'blue'],
model2: [{color:'green'}]
};
}
});
In handlebars I can access the model 2 like
{{#each item in model2}}
<li>{{model2.color}}</li>
{{/each}}
How can I access model2 without using {{each}}?
When I use,
<li>{{model2.color}}</li>
it reurns no value, when I use
<li>{{model2}}</li>
it shows [object Object] so how can I access model2 objects without using {{#each}}?
JsBin : http://emberjs.jsbin.com/tuvozuwa/6/edit Thanks
Upvotes: 1
Views: 291
Reputation: 1072
I tried {{model2.[0].color}}
and it worked in your context. (Note the dot (.
) after model
.)
Upvotes: 2