Function
A Ember.NativeArray public
Module: | ember |
---|
Defined in packages/@ember/-internals/runtime/lib/mixins/array.js:1906
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
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])); } } });
© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/3.25/functions/@ember%2Farray/A