gar*_*hdn 4 typescript angular angular-router
我不知道是否有一种方式来获得该URL 将被角的路由器调用时产生的navigate方法.
例如:
this._router.navigate(['browse'], { queryParams: { section: 'users', isActive: true } });
可能会导致导航 /browse#?section=users&isActive=true
如何在不执行导航或更新浏览器中的URL的情况下获取此路线?
this._router.createUrlTree(
['browse'], { queryParams: { section: 'users', isActive: true } });
Run Code Online (Sandbox Code Playgroud)
返回的对象,a UrlTree有一个toString应该给你你想要的功能.
您可以从内部实际使用的源中看到:navigatecreateUrlTree
navigate(commands: any[], extras: NavigationExtras = {skipLocationChange: false}):
Promise<boolean> {
validateCommands(commands);
return this.navigateByUrl(this.createUrlTree(commands, extras), extras);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1234 次 |
| 最近记录: |