Skip to content

Instantly share code, notes, and snippets.

@gokatz
Last active February 18, 2016 09:59
Show Gist options
  • Save gokatz/4a29c68146d33b996428 to your computer and use it in GitHub Desktop.
Save gokatz/4a29c68146d33b996428 to your computer and use it in GitHub Desktop.
closure test
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'CodeX',
actions: {
popName(name) {
alert(name);
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{my-component submit=(action 'popName')}}
<br>
<br>
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
onclick() {
this.submit(this.get('name'));
this.attrs.submit('hai! '+this.get('name'));
this.set('name', '');
}
}
});
{{input value=name placeholder='your name'}}
<button {{action 'onclick'}}>click</button>
{
"version": "0.5.3",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.1.2",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.3.3/ember-data.js",
"ember-template-compiler": "2.1.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment