Skip to content

Instantly share code, notes, and snippets.

@1276stella
Last active November 30, 2018 04:49
Show Gist options
  • Save 1276stella/75f73573fc7ee501528576e8141eb399 to your computer and use it in GitHub Desktop.
Save 1276stella/75f73573fc7ee501528576e8141eb399 to your computer and use it in GitHub Desktop.
sendAction
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
buttonClick() {
this.sendAction('buttonClick');
}
}
});
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
buttonClick() {
console.log('hello from wrapper-2.js');
this.sendAction('buttonClick');
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
buttonClick() {
console.log('hello from app.js');
window.alert('I am clicked');
}
}
});
{{button-wrapper-1 buttonClick="buttonClick"}}
{{button-wrapper-2 buttonClick="buttonClick"}}
<button {{action "buttonClick"}}>Button</button>
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment