samedi 17 septembre 2016

ember - closure action results in error, will not render page unless action is provided in component

I'm trying to understand closure actions and am just testing out some code, however I can't seem to get it to work. In my index.hbs template I have rendered a component like so:



In my index.js controller I have defined the action foo:

  foo: function () {
    console.log('foo executed');
  },

And in my test-component.hbs component I have a button that triggers the action like so:

<button >Test Button</button>.

However the page crashes and I get the following error in the console: Uncaught Error: An action named 'test' was not found

I can make the page render again by inserting a test action in the test-component.hbs however I was under the impression that you using closure actions, you didn't need to put anything in your component? What am I doing wrong here?




Aucun commentaire:

Enregistrer un commentaire