Created
August 4, 2015 03:16
-
-
Save ivanvanderbyl/fcde2819258f2de26685 to your computer and use it in GitHub Desktop.
Data Down, Actions Up example
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
export default Ember.Component.extend({ | |
count: 0, | |
actions: { | |
incrementCount: function() { | |
this.set('count', this.get('count') + 1); | |
if(this.attrs['on-change']) { | |
this.attrs['on-change'](this.get('count')); | |
} | |
} | |
} | |
}); |
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
// controllers/index.js | |
export default Ember.Controller.extend({ | |
// Count prop bound to my-counter component. | |
count: 1, | |
actions: { | |
handleCounterChange(newCount) { | |
this.set('count', newCount); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment