How to get toState param with $transitions service? (new ui-router)
Follow documents, check Class Transition Methods, toState
in old version equal $to()
in new version
Old version:
$scope.$on('$stateChangeSuccess', function(evt, toState, toStateParams, fromState) {
var oldToState = toState;
}
New version (current is 1.0.0-beta.3):
$transitions.onSuccess({}, function($transitions){
var newToState = $transitions.$to();
}
From Interface HookMatchCriteria:
This object is used to configure whether or not a Transition Hook is invoked for a particular transition, based on the Transition's "to state" and "from state".
Hope this help!
Use $transition$.$to() for it.
$transitions.onStart( {}, function($transition$) {
// stateTo === $transition$.$to();
// Check $transition$.$to().name for state name
});