Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angularjs: Referencing an element in array of objects in templates

Tags:

angularjs

I need to display three elements per row on a page, from data that I get as array, so would like ability to reference a specific element inside array.

I.e. if my array is bookList, I'd like to be able to get at 3rd element of bookList so I can pass it to a directive, for example. Don't see an easy way to do this.

[edit]

{{bookList[2]}}
like image 302
Jean Barmash Avatar asked Jun 28 '13 18:06

Jean Barmash


1 Answers

Elements of the list are accessible via an integer property thus:

{{bookList.0}} {{bookList.1}} {{bookList.2}} ...
like image 78
John Mee Avatar answered Sep 27 '22 20:09

John Mee