Skip to content

Instantly share code, notes, and snippets.

@courthead
Created December 17, 2015 02:31
Show Gist options
  • Save courthead/b36807b311324b1be59a to your computer and use it in GitHub Desktop.
Save courthead/b36807b311324b1be59a to your computer and use it in GitHub Desktop.
Undefined closure actions
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
actions: {
handleClickOnA: function () {
alert('a was clicked');
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{my-thing click-a=(action "handleClickOnA")}}
<br>
<br>
import Ember from 'ember';
export default Ember.Component.extend({
});
<button onclick={{action (action attrs.click-a)}}>Button A</button>
<br><br>
Button B is commented out. Uncomment it and the code will break with error <strong style="background-color:hsl(60, 100%, 92%);">"Cannot read property 'INVOKE [id=...]' of null"</strong>.
{{!--
<button onclick={{action (action attrs.click-b)}}>Button B</button>
--}}
{
"version": "0.4.17",
"EmberENV": {
"FEATURES": {}
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment