jeudi 22 septembre 2016

Ember unable to pass router action to component

I have a component that need to receive an action that I placed on the router since its job is to refresh part of the model.

Apparently I can call the router action from a button but I am not able to pass the same action down to the component.

The router

export default Ember.Route.extend({
    actions: {
        doSomething: function(){
            alert('Router handled!');
        }
    }
});

The page template

<button >speak</button>


The component

export default Ember.Component.extend({
    actions: {
        onPageClicked: function(pageNo){
            this.sendAction('onGetUsers', pageNo);
        }
    }
});

The button click works. When I use the component I make it to its action but the sendAction never work or fires.

Is there a rule that I cannot pass actions to down line components? or am I doing something wrong in the code?




Aucun commentaire:

Enregistrer un commentaire