Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了在儿童路线Angular 2之间导航大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我似乎无法在子路线之间导航.

路由器概述:

path: 'parent',component: parentComponent,children: [
            { path: '',redirectTo: 'child1',pathMatch: 'full' },{ path: 'child1',component: child1Component },{ path: 'child2',component: child2Component },{ path: 'new/:type',component: child3Component },{ path: '**',component: PageNotFoundComponent }
        ]

我在child1组件中尝试导航到新的/类型路由,如下所示:

this._router.navigate(['new',objType],{ relativeTo: this._route });

但我不断收到错误:无法匹配任何路线.网址细分:’新/资产’.

如果我手动插入网址,它工作正常.

非常感谢帮助,谢谢!

您可以使用 ../
this._router.navigate(['../new',{ relativeTo: this._route });

大佬总结

以上是大佬教程为你收集整理的在儿童路线Angular 2之间导航全部内容,希望文章能够帮你解决在儿童路线Angular 2之间导航所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。