Skip to content

Instantly share code, notes, and snippets.

@WenInCode
Created February 26, 2019 05:37
Show Gist options
  • Save WenInCode/3604dfddafc11dce049b28c0c87ae6ee to your computer and use it in GitHub Desktop.
Save WenInCode/3604dfddafc11dce049b28c0c87ae6ee to your computer and use it in GitHub Desktop.
Ember Closure Actions
<button {{action toggleAction}}>Toggle</button>
import Component from '@ember/component';
export default Component.extend({
didReceiveAttrs() {
debugger;
this._super(...arguments);
}
});
Current Value: {{currentValue}}<br>
{{child-component toggleAction=(action "toggleCurrentValue")}}
import Component from '@ember/component';
export default Component.extend({
currentValue: false,
actions: {
toggleCurrentValue() {
debugger;
this.toggleProperty('currentValue');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment