jeudi 14 avril 2016

Call action from parent component in Ember 2.x

I am trying to call an action from a parent component in my route view.

mychild.hbs

{{#parent as |wrapper|}}
    <button {{action "animate"}}>Login</button>
{{/parent}}

parent.hbs

<div>{{yield}}</div>

mychild route (no actions)

export default Ember.Route.extend(
});

mychild controller

export default Ember.Controller.extend({
});

parent component

export default Ember.Component.extend({

    actions: {
        animate() {
            console.log('ok');
        }
    },
});

How to call animate() from my component ? What am I doing wrong ?

Aucun commentaire:

Enregistrer un commentaire