Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Ember from 'ember';
- export default Ember.Component.extend({
- _array: [],
- array: Ember.computed('_array',{
- get(key) { return this.get('_array'); },
- set(key,value) { this.set('_array', value); }
- }),
- isEmpty: Ember.computed('array', function() {
- // Here, this.get('array') returns undefined. Why?
- return this.get('array').length;
- }),
- actions: {
- addNew() {
- this.get('array').push(Date.now());
- }
- },
- init() {
- this._super(...arguments);
- this.set('array', [1,2,3]);
- // If I call this.get('array') here, undefined is returned even though I just set it.
- },
- });
Add Comment
Please, Sign In to add comment