Cereal Killer
Cereal Killer

Reputation: 3414

Accessing array element in Ember handlebars

I have a simple array in the controller:

App.HomeController = Ember.Controller.extend({
    items: ['item1', 'item2', 'item3']
});

I would like to render the first element in the template; following instructions in other posts I'm doing:

{{items.[0]}}

Or this…

{{controller.items.[0]}}

…but the result is always nothing; am I doing anything wrong here?

Upvotes: 12

Views: 8209

Answers (1)

panta82
panta82

Reputation: 2721

You're doing nothing wrong. These should work (demo). The problem lies somewhere else. Can't tell without more code.

Upvotes: 12

Related Questions