Using enumerables with arrays

The Ember.Enumerable methods are very important when dealing with arrays. In these recipes, we'll look at some common use cases.

Getting ready

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

unshift

unshiftObject

shift

shiftObject

reverse

reverseObjects

push

pushObject

pop

popObject

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 ...

Get Ember.js Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.