Skip to content

Instantly share code, notes, and snippets.

@samselikoff
Created March 21, 2016 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samselikoff/ac3f043281b4c4dde1cc to your computer and use it in GitHub Desktop.
Save samselikoff/ac3f043281b4c4dde1cc to your computer and use it in GitHub Desktop.
Action inside <a>
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
toggleFoo() {
this.toggleProperty('foo');
},
inputDidChange() {
this.toggleProperty('bar');
return false;
}
}
});
<h1>Welcome to {{appName}}</h1>
<a {{action 'toggleFoo'}} href="#">
Toggle Foo
<label>
<input onchange={{action "inputDidChange" value="target.value" bubbles=false}} type="checkbox">
Check me
</label>
</a>
<h2>Foo is {{foo}}</h2>
<h2>Bar is {{bar}}</h2>
{
"version": "0.6.5",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment