vendredi 8 septembre 2017

Ember adding action to template for parent/child communication

I am trying to define a custom action to my Ember component & want to communicate between parent/child.

In my-child.js, I have

actions: {
    someCustomAction: function() {
        let self = this;
        self.sendAction('someCustomAction');
    },
}

And I catch the same in my-parent.js as below;

actions: {
    someCustomAction: function (){
        console.log("Inside someCustomAction...."); 
    }       
}

Now, with the above code, control/action does not come to my-parent.js

I have to add "someCustomAction" to the template as below

In my-parent.hbs



I wanted to know the exact reason for the same. Why does just doing sendAction not automtically work ?




Aucun commentaire:

Enregistrer un commentaire