I send request to the server and want conditionally redirect to another page (not angular) after response is received. Thus navigation happens inside then
part of a promise.
I tried:
$location.path(url)
and
$window.location.href = url;
$windo.location.reload();
nothing works.
But if I wrap either of these two calls with setTimeout(navigate,0)
redirection occurs.
Seems like Angular guards url during digest cycle.
Can anyone clarify or share the links explaining what really happens.
After doing the change, and before ending the promise handler, try doing:
$scope.$$phase || $scope.$apply();
That should populate the changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With