Created
June 19, 2017 05:28
-
-
Save kumkanillam/e82fd63148f93ddffc9f810ae4294da3 to your computer and use it in GitHub Desktop.
Ember parent child component, how to avoid unnecessary life cycle hook from triggering? - with powerselect
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.Component.extend({ | |
name:'mycomp', | |
init(){ | |
this._super(...arguments); | |
console.log(' init mycomponent'); | |
}, | |
didReceiveAttrs(){ | |
console.log('didReceiveAttrs mycomponent'); | |
}, | |
didUpdateAttrs(){ | |
console.log('didUpdateAttrs mycomponent'); | |
}, | |
willUpdate(){ | |
console.log('willUpdate mycomponent'); | |
}, | |
didInsertElement(){ | |
console.log('didInsertElement mycomponent'); | |
}, | |
didUpdate(){ | |
console.log('didUpdate mycomponent'); | |
}, | |
willRender(){ | |
console.log('willRender mycomponent'); | |
}, | |
didRender(){ | |
console.log('didrender mycomponent'); | |
}, | |
actions:{ | |
toChange(){ | |
this.set('name','ChangedInMyComp '+new Date().toISOString()); | |
} | |
} | |
}); |
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.Component.extend({ | |
name:'mycomp2', | |
cities: ['Barcelona', 'London', 'New York', 'Porto'], | |
destination: 'London', | |
init(){ | |
this._super(...arguments); | |
console.log(' init mycomponent2'); | |
}, | |
didReceiveAttrs(){ | |
console.log('didReceiveAttrs mycomponent2'); | |
}, | |
didUpdateAttrs(){ | |
console.log('didUpdateAttrs mycomponent2'); | |
}, | |
willUpdate(){ | |
console.log('willUpdate mycomponent2'); | |
}, | |
willRender(){ | |
console.log('willRender mycomponent2'); | |
}, | |
didUpdate(){ | |
console.log('didUpdate mycomponent2'); | |
}, | |
didInsertElement(){ | |
console.log('didInsertElement mycomponent2'); | |
}, | |
didRender(){ | |
console.log('didrender mycomponent2'); | |
}, | |
actions:{ | |
toChange(){ | |
this.set('name','ChangedInMyComp '+new Date().toISOString()); | |
}, | |
chooseDestination(city) { | |
this.set('destination', city); | |
} | |
} | |
}); |
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({ | |
}); |
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.12.1", | |
"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.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
}, | |
"addons": { | |
"ember-data": "2.12.1", | |
"ember-power-select": "1.8.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment