Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In an Ember Array, how do i access object by index value? Ember Js

For an ember array you can simply do this:

array.get('firstObject');

to get the first object in array.

or this:

array.get('lastObject');

to get last object in array.

How do I get something by its index? similar to how it works in an ordinary javascript array:

array[index];

like image 928
user2800382 Avatar asked Apr 30 '15 23:04

user2800382


Video Answer


1 Answers

Looking at the documentation, you could just do var myObject = array.objectAt(someIndex);, and that will return the object at that specific index. You can check the documentation here.

like image 168
heinst Avatar answered Oct 19 '22 23:10

heinst