Using this code:
this.router.navigateByUrl('/login');
I get the following warning: promise returned from navigatebyurl is ignored. How and when would I want to handle the promise here?
P.S. I'm using this in AuthGuard's canActivate
.
The navigateByUrl function returns a promise so you can use .then() method :
this.router.navigateByUrl('/login').then(() => {
// Do something
});
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