Sam*_*mmy 6 promise angular-routing angular
使用此代码:
this.router.navigateByUrl('/login');
我收到以下警告:从navigationbyurl返回的promise被忽略。我想在何时何地兑现承诺?
PS我正在AuthGuard的中使用它canActivate。
小智 10
navigateByUrl 函数返回一个承诺,因此您可以使用 .then() 方法:
this.router.navigateByUrl('/login').then(() => {
// Do something
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5397 次 |
| 最近记录: |