Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/423.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 子出口中的角度子路由_Javascript_Angular - Fatal编程技术网

Javascript 子出口中的角度子路由

Javascript 子出口中的角度子路由,javascript,angular,Javascript,Angular,在我的TestComponent中,我有一个导航栏,其中包含指向多个组件的链接,我想在TestComponent中的子路由器出口中显示这些组件,但它会抛出此错误 core.js:6237错误:未捕获(承诺中):错误:无法匹配 任何路线。URL段:“仪表板/测试/id” 您的routerLink应该是 [routerLink]=“['/dashboard/test',{outlets:{sub:['id']}}]”你能分享你的routerLink html代码吗?你没有任何路由器配置leo pat

在我的TestComponent中,我有一个导航栏,其中包含指向多个组件的链接,我想在TestComponent中的子路由器出口中显示这些组件,但它会抛出此错误

core.js:6237错误:未捕获(承诺中):错误:无法匹配 任何路线。URL段:“仪表板/测试/id”


您的routerLink应该是


[routerLink]=“['/dashboard/test',{outlets:{sub:['id']}}]”你能分享你的routerLink html代码吗?你没有任何路由器配置leo path吗?
  • 运行id
  • 指定路由器的routerLink配置将不同语法。我认为你犯了一些语法错误。你能创建stackblitz吗?现在没关系。如果我在浏览器中更改url,它将无法正常工作。
    const routes: Routes = [
          {
            path: '',
            redirectTo: 'dashboard/test',
            pathMatch: 'full'
          },
          {
            path: 'dashboard',
            children: [
              {
                path: 'test',
                component: TestComponent,
                children: [
                  {
                    path: '',
                    redirectTo: 'id',
                    pathMatch: 'full'
                  },
                  {
                    path: 'id',
                    component: IdComponent,
                    outlet: 'sub'
                  }
                ]
              }
            ]
          }
        ];