Last active
July 4, 2017 14:58
-
-
Save ctusch/8b35d8e8fa490cf0941469c0d8ab0469 to your computer and use it in GitHub Desktop.
ArrayProxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
arr1: Ember.A([{a:1,b:2},{a:3,b:4}]), | |
arr: Ember.ArrayProxy.extend({ | |
init() { | |
this.set('content', Ember.A([{a:1,b:2},{a:3,b:4}])); | |
this._super(...arguments); | |
}, | |
m1() { | |
//debugger; | |
Ember.set(this.get('content').objectAt(0), 'a', 2); | |
this.pushObject({a:5, b:6}); | |
}, | |
/*contentArrayWillChange(contentArray, start, removeCount, addCount) { | |
this.arrayContentWillChange(start, removeCount, addCount); | |
}, | |
contentArrayDidChange(contentArray, start, removeCount, addCount) { | |
this.arrayContentDidChange(start, removeCount, addCount); | |
}*/ | |
}).create(), | |
click() { | |
this.get('arr').m1(); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.10.5", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.8.2", | |
"ember-data": "2.8.0", | |
"ember-template-compiler": "2.8.2", | |
"ember-testing": "2.8.2" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment