Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nathanhammond/fecb837996ee9768f90d8a36f9501251 to your computer and use it in GitHub Desktop.
Save nathanhammond/fecb837996ee9768f90d8a36f9501251 to your computer and use it in GitHub Desktop.
Action Bindings
import Ember from 'ember';
export default Ember.Component.extend({
member: 'foo',
bleet(a, b, c) {
console.log('Member bleet!', arguments);
console.log(this.get('foo'));
},
actions: {
bleet(a, b, c) {
console.log('Action bleet!', arguments);
this.set('foo', this.get('foo') + '1');
console.log(this.get('foo'));
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
{{#parent-component}}Clicky!{{/parent-component}}
<br>
<br>
<button {{action bleet member}}>{{yield}}</button>
<button {{action "bleet" member}}>{{yield}}</button>
{
"version": "0.8.0",
"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.5.1",
"ember-data": "2.5.2",
"ember-template-compiler": "2.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment