Working with collections

Ember makes array manipulation smarter using a set of core collection classes, shown in the following table. Each of these provide many convenient methods that abstract complex array manipulation:

Collection type

Description

Ember.Array

This is an abstract implementation of observer-friendly array-like behavior. Concrete implementations are expected to have implemented methods, such as length() and objectAt(). Notable convenient methods are any(), every(), filter(), filterBy(), find(), findBy(), forEach(), getEach(), map(), mapBy(), objectAt(), replace(), reverse(), sortBy, without(), and so on.

Ember.ArrayProxy

ArrayProxy wraps objects that implement Ember.Array for binding use cases and swapping content while iterating.

Ember.MutableArray

This is an extension of Array, supporting an array of ordered sets.

Ember.Enumerable

This is a mixin for enumerating arrays.

Ember.NativeArray

This is the most concrete implementation of all of the above. You would use this in most cases.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset