-
-
Save amk221/fb3502e96650dab5b86261bf1362eb71 to your computer and use it in GitHub Desktop.
Computed Oddity
This file contains 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 Component from 'ember-component'; | |
import computed from 'ember-computed'; | |
export default Component.extend({ | |
didReceiveAttrs() { | |
this._super(...arguments); | |
// Comment this line to fix | |
this.get('sum'); | |
this.set('number', this.get('my-attr')); | |
}, | |
sum: computed('number', function() { | |
console.log('computing', this.get('number')); | |
return this.get('number') + 10; | |
}) | |
}); |
This file contains 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 Controller from 'ember-controller'; | |
export default Controller.extend({ | |
number: 0, | |
actions: { | |
inc() { | |
this.incrementProperty('number'); | |
} | |
} | |
}); |
This file contains 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
div { display: inline } |
This file contains 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": "release", | |
"ember-template-compiler": "release", | |
"ember-testing": "release" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment