Created
May 12, 2016 05:50
-
-
Save kumkanillam/31f40c4ee3e0c475edce22a8d2b8b85d to your computer and use it in GitHub Desktop.
how-to-pass-controller-observed-property-in-component
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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
tagName:'', | |
currentValue:function(){ | |
return this.get('value'); | |
}.property('value'), | |
minValue:function(){ | |
return this.get('min'); | |
}.property('min'), | |
didRender:function(){ | |
this._super(...arguments); | |
console.log("Render component with currentValue="+this.get("currentValue")+" minValue="+this.get('minValue')); | |
} | |
}); |
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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
currentVal:50, | |
currentValChanged:function(){ | |
console.log("currentVal changed : "+this.get('currentVal')); | |
}.observes('currentVal'), | |
actions: { | |
changeCurrentVal(){ | |
this.set('currentVal',Math.floor((Math.random() * 100) + 1)); | |
} | |
} | |
}); |
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.8.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "1.13.13", | |
"ember-data": "2.5.2", | |
"ember-template-compiler": "1.13.13" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment