Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rerender entire tree
import Ember from 'ember';
export default Ember.Component.extend({
didReceiveAttrs(){
this._super(...arguments)
console.log('didReceiveAttrs', 'a-child')
}
});
import Ember from 'ember';
export default Ember.Component.extend({
aPropertyInsideTheParent: "a",
didReceiveAttrs(){
this._super(...arguments)
console.log('didReceiveAttrs', 'the-parent')
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
data: {val: 1},
actions: {
increment(){
Ember.set(this, "data", {
val: Ember.get(this, "data.val") + 1
})
}
}
});
<button {{action "increment"}}>Inc</button>
{{the-parent data=data}}
<p> Open the console to see `a-child` component rerendering even though nothing passed to them changed.</p>
a-child component: {{val}}
{{data.val}}
{{a-child val=aPropertyInsideTheParent}}
{{a-child val=aPropertyInsideTheParent}}
{{a-child val=aPropertyInsideTheParent}}
{{a-child val=aPropertyInsideTheParent}}
{
"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": "beta",
"ember-data": "2.8.0",
"ember-template-compiler": "beta",
"ember-testing": "beta"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.