Wojciech Bednarski
Wojciech Bednarski

Reputation: 6373

How to display specific item from array in Ember.js's template?

Is there any way to do something like that in Ember.js template?

{{someObject.someArray[0].arrayPropery}}

When object structure looks like this:

someObject: {
    someArray: [
        {
            arrayProperty: 'Show me in template!'
        }
    ]
}

Upvotes: 1

Views: 1601

Answers (1)

Willem de Wit
Willem de Wit

Reputation: 8732

You could use: {{ someObject.someArray.firstObject.property }} but it's better to provide a computed property in your controller which returns the desired property.

Upvotes: 1

Related Questions