STEVER STEVER -5 years ago 409
Javascript Question

How to get toState param with $transitions service? (new ui-router)

I'm using ui-router 1.0.0-alpha.3.
Old events are deprecated there.

so I'm trying to convert

$rootScope.$on('$stateChangeStart', (event, toState) => {

to new way of doing things with $transitions.onStart hook -

$transitions.onStart( {}, function($state, $transition$) {

where could I get toState param in this case?

Answer Source

Use $transition$.$to() for it.

$transitions.onStart( {}, function($transition$) {
    //stateTo === $transition$.$to();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download