我正在尝试通过单击该图标导航到新页面,并且组件如下所示
getTabDetails() {
switch (this.tabContent) {
case 'Shipment content':
{
this.router.navigateByUrl('/ProjectShipment/000634');
}
}
}
我的“路由”组件如下所示
const appRoutes: Routes = [
{
path: 'dB',
data: { title: 'Dashboard' },
children: [
{
path: 'ProjectShipment/:reportProject',
component: ProjectShipmentComponent,
data: { title: 'Project Shipment' },
}
单击图标时出现以下错误
错误:未捕获(承诺):错误:无法匹配任何路由。 URL段:“ ProjectShipment / 000634” 错误:无法匹配任何路线。网址段:“ ProjectShipment / 000634”
但是当我尝试直接通过URL访问页面时
http://localhost:4200/dB/ProjectShipment/000634
我在这里想念东西吗?
答案 0 :(得分:1)
您可以尝试:
this.router.navigateByUrl(['ProjectShipment',000634], relativeTo:this.route);
其中
private route: ActivatedRoute
如果您位于/ dB路径
答案 1 :(得分:0)
self.router.navigate(['./ProjectShipment/000634']);