Skip to content

Instantly share code, notes, and snippets.

@mwpastore
Last active September 19, 2017 23:22
Show Gist options
  • Save mwpastore/f8482ea8da969919117c06dc0d266ad5 to your computer and use it in GitHub Desktop.
Save mwpastore/f8482ea8da969919117c06dc0d266ad5 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
greeting: 'Hello',
actions: {
showAlert(message) {
const greeting = this.get('greeting');
alert(`${greeting}, ${message}!`);
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
message: 'world',
actions: {
callAction(action) {
const message = this.get('message');
action(message);
}
}
});
{{#my-component as |c|}}
<button onclick={{action 'callAction' c.showAlert}}>Click me</button>
{{/my-component}}
{{yield (hash showAlert=(action 'showAlert'))}}
{
"version": "0.12.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment