Function
A Ember.NativeArray public
Module:
ember
Defined in packages/@ember/-internals/runtime/lib/mixins/array.js:1519
import { A } from '@ember/array'; |
- returns
- Ember.NativeArray
Creates an Ember.NativeArray
from an Array-like object.
Does not modify the original object's contents. A()
is not needed if
EmberENV.EXTEND_PROTOTYPES
is true
(the default value). However,
it is recommended that you use A()
when creating addons for
ember or when you can not guarantee that EmberENV.EXTEND_PROTOTYPES
will be true
.
Example
component.js | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import Component from '@ember/component'; import { A } from '@ember/array'; export default Component.extend({ tagName: 'ul', classNames: ['pagination'], init() { this._super(...arguments); if (!this.get('content')) { this.set('content', A()); this.set('otherContent', A([1,2,3])); } } }); |