jeudi 22 octobre 2015

How can i call a controller method or action from route setupController in ember 2.0

Im trying to call a controller action from the route.

setupController(controller, model) {


        controller.set('model', model);

        //controller.send('showInvite');
        controller.send('switchTabByName',model.get('name'));


        if(!this.get('state.user.hasCopiedInviteLink')) {
            controller.send('showInvite');
        }

but i cant i get "publish.continue Nothing handled the action 'switchTabByName'."

ive tried to call a method directly without an action but didn't worked either. How can i achieve this?

This is my actions block in the controller

actions: {

        switchTabByName(tabName){
                //console.log('Will switch to tab ',tabName);
                let tab = this.get('tabs').find((item)=> {return item.get('name')===tabName; } );
                this.switchTab(tab);

        },




Aucun commentaire:

Enregistrer un commentaire