Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 388
Cereal Killer Avatar asked May 18 '14 14:05

Cereal Killer


Video Answer


1 Answers

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

like image 174
panta82 Avatar answered Sep 28 '22 03:09

panta82