The
Ember.Enumerable
methods are very important when dealing with arrays. In these recipes, we'll look at some common use cases.
To understand how to use enumerables, we must first take a look at the standard JavaScript array methods and their equivalents using observable enumerables:
Standard method |
Observable equivalent |
---|---|
|
|
|
|
|
|
|
|
|
|
We'll be using some of these methods in our examples, so keep in mind what the standard and observable equivalents are.
The Ember.Enumerable
class has several methods that we can use in our Ember applications. Here is the list of the more common methods and what they do:
Enumerable method |
Definition |
---|---|
|
This iterates through the enumerable, calling the passed function on each item |
|
This returns the first object in a collection |
|
This returns the last object in a collection |
|
This maps all the... |