Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save miguelcobain/2e51ce6ba218fd1c7aa9 to your computer and use it in GitHub Desktop.
Save miguelcobain/2e51ce6ba218fd1c7aa9 to your computer and use it in GitHub Desktop.
Computed property lifecycle
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
{{my-component string1="Hi" string2="Guys"}}
import Ember from 'ember';
export default Ember.Component.extend({
output: Ember.computed('string1', 'string2', function() {
return this.get('string1') + ' ' + this.get('string2');
})
});
{{string1}} {{string2}}
<br/>
{{output}}
{
"version": "0.5.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment