Skip to content

Instantly share code, notes, and snippets.

@adam-knights
Created December 22, 2015 10:06
Show Gist options
  • Save adam-knights/547ceb6019bf444f0a7f to your computer and use it in GitHub Desktop.
Save adam-knights/547ceb6019bf444f0a7f to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
apple() {
alert('action is available');
},
checkActionAvailable: function(actionName) {
console.log(this);
if(Em.get(this.actions,actionName)) {
this.send(actionName);
}
},
}
});
<h2> Why are actions not available in this.actions ? </h2>
<br>
<br>
<button {{action 'checkActionAvailable' 'apple'}}> click here</button>
{{outlet}}
<br>
<br>
{
"version": "0.4.17",
"EmberENV": {
"FEATURES": {}
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "1.13.11",
"ember-data": "1.13.15",
"ember-template-compiler": "1.13.11"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment