ember set triggers
{
"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.0",
"ember-data": "2.8.0",
"ember-template-compiler": "2.8.0",
"ember-testing": "2.8.0"
},
"addons": {}
}
<h1>Welcome to {{appName}}</h1>
<br>
{{my-comp test=test}}
<button {{action 'setSame'}}>Set Same</button>
<button {{action 'setNew'}}>Set New</button>
<br>
{{outlet}}
<br>
<br>
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
test: {a:1},
actions: {
setSame() {
this.set('test', this.get('test'));
},
setNew() {
this.set('test', {a:1});
}
}
});
import Ember from 'ember';
export default Ember.Component.extend({
didUpdateAttrs() {
console.log(this.get('test.a'));
}
});