在儿童路线Angular 2之间导航
发布时间:2020-12-17 07:33:45 所属栏目:安全 来源:网络整理
导读:我似乎无法在子路线之间导航. 路由器概述: path: 'parent',component: parentComponent,children: [ { path: '',redirectTo: 'child1',pathMatch: 'full' },{ path: 'child1',component: child1Component },{ path: 'child2',component: child2Component },
我似乎无法在子路线之间导航.
路由器概述: 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 }); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |