路由器链接和 router.navigate
routerlink and router.navigate
我读到 routerlink 隐式调用 relativeTo 而 this.router.navigate 没有。
知道这些信息,我似乎仍然无法完成以下工作。
routerlink 工作并给了我以下地址:
http://localhost/main/(aux:crypto/5a599f35af967b0017d1be6f/blogoutlet:steemblog:)
但是:
this.router.navigate([{销售点: { 'blogoutlet' : ['steemblog']}}])
只给出:
http://localhost/main/(aux:crypto/5a599f35af967b0017d1be6f)
每次我试图改变这些路径时,我都很难理解正在发生的事情,而且我花了很长时间才弄明白。
有没有我可以遵循的简单规则?
[routerLink]
可以在 html 中用于 or 元素。这将导航到使用 params
创建的路径,提供给 routerLink。
this.router.navigate(['/detail', this.selectedHero.id]);
在您的 component.ts 或服务中用于导航到路径中提供的特定组件。
我读到 routerlink 隐式调用 relativeTo 而 this.router.navigate 没有。
知道这些信息,我似乎仍然无法完成以下工作。
routerlink 工作并给了我以下地址:
http://localhost/main/(aux:crypto/5a599f35af967b0017d1be6f/blogoutlet:steemblog:)
但是:
this.router.navigate([{销售点: { 'blogoutlet' : ['steemblog']}}])
只给出:
http://localhost/main/(aux:crypto/5a599f35af967b0017d1be6f)
每次我试图改变这些路径时,我都很难理解正在发生的事情,而且我花了很长时间才弄明白。 有没有我可以遵循的简单规则?
[routerLink]
可以在 html 中用于 or 元素。这将导航到使用 params
创建的路径,提供给 routerLink。
this.router.navigate(['/detail', this.selectedHero.id]);
在您的 component.ts 或服务中用于导航到路径中提供的特定组件。