Answer the question
In order to leave comments, you need to log in
How to prevent a route change on $routeChangeStart so that $routeChangeError will work after?
There is a bunch of events
$rootScope.$on('$routeChangeStart', (event, next, current) => {
console.log('current', current, next);
event.preventDefault();
});
$rootScope.$on('$routeChangeError', (event, current, prevoius, reason) => {
console.log('err', [event, current, prevoius, reason]);
});
Answer the question
In order to leave comments, you need to log in
The task is still not entirely clear (if there are some "buts" there), but it is done like this:
select distinct group_id from (
select group_id from place
union
select group_id from promo
) x;
After preventDefault, nothing should work.
routeChangeError occurs when one of the resolve promises is rejected, in fact it is better to hang up the check in state.resolve, and not in $routeChangeStart.
In general, with the release of 1.x UI-router, everything has become much cooler in this regard. Including there you can do what you want, namely transition hooks .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question