$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams){
// stop the transition
event.preventDefault();
// $resource processing
, success(function{
$state.go('state');
})
, error (function() {something})
}
Routing uses ui-router.
We have done the above to achieve page transition, but
When you press Back Browser
Loop between the previous screen and the displayed screen.
That's it.
If you want to synchronize, or if you want your browser to return or detect progress,
I think we can handle it, but how should we implement it?
In this state, it is added to the history of the direction in which it goes after returning to disable it, so the same thing will be repeated again and it will cause a loop.
$state.go('state', {}, {location:'replace'});
If the optional location property of $state.go is "replace", the history will be replaced.
© 2024 OneMinuteCode. All rights reserved.