How to get next route after the current route deactivate.?

353 views Asked by At

I have some code that uses route 'deactivate' method as follows.

 deactivate: function() {
        this._super();
        //some code here

    }

Is there a way to identify where is user trying to go(route of URL) after this route deactivates?

1

There are 1 answers

1
Ember Freak On BEST ANSWER

I would encourage you to use willTransition actions method hook for this purpose since that will be called before deactivate hook method.

transition.targetName will provide the target route.

actions: {        
        willTransition(transition) {
            this._super(...arguments);
            console.log('willTransition user ', transition.targetName);
        }
    }