Skip to content

Instantly share code, notes, and snippets.

@tchan
Last active July 30, 2017 10:24
Show Gist options
  • Save tchan/46598e22f4e5d22b8a4d1143dca7ccda to your computer and use it in GitHub Desktop.
Save tchan/46598e22f4e5d22b8a4d1143dca7ccda to your computer and use it in GitHub Desktop.
Ember Actions
{{end-game-modal quitFromController='quit' resetFromController='reset'}}
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
quit() {
//do quit code
},
reset() {
//do reset code
}
}
});
<button> {{action "reset"}} Reset </button>
<button> {{action "quit"}} Quit </button>
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
quit() {
this.sendAction('quitFromController');
},
reset() {
this.sendAction('resetFromController');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment