samedi 27 février 2016

ember action 'Nothing handled the action' within block component

If I have component in block form:

//some-component.hbs
{{#some-component}}
    <button {{action "someAction"}}>test</button>
     <!-- assume you have multiple buttons here with multiple actions -->
{{/some-component}}

//some-component.js
Ember.Component.extend({
    actions: {
        someAction() {
            alert('NOT BEING CALLED');
        }
    }
});

using Ember > v2.0. The action is not being called. If I call it:

{{some-component}}

and put:

<button {{action "someAction"}}>test</button>

inside the some-component.hbs template. then it works. but this way has some drawbacks which I want to avoid.

I've looked at the docs and everywhere it doesn't seem to have this sort of case.




Aucun commentaire:

Enregistrer un commentaire