Skip to content

Instantly share code, notes, and snippets.

@GavinJoyce
Created March 29, 2016 14:36
Show Gist options
  • Save GavinJoyce/0b8454e11fadfc3ef116 to your computer and use it in GitHub Desktop.
Save GavinJoyce/0b8454e11fadfc3ef116 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
runAction1: true,
actions: {
action1: function() {
this.set('appName', 'action1 was run');
},
action2: function() {
this.set('appName', 'action2 was run');
}
}
});
<h1>Dynamic action name</h1>
<h2>{{appName}}</h2>
<br>
<br>
runAction1:
{{input type='checkbox' checked=runAction1}}
<button {{action (if runAction1 'action1' 'action2')}}>Click Me</button>
{
"version": "0.7.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": "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.3/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