0

我正在尝试在父组件之外显示一个子组件(但我需要我的路由器将子组件用于我的面包屑),这是我的路由定义:

const routes: Routes =[ 
  { 

    path: '',component: PagesComponent, 
    children: [ 

      // HOME ********************************* 

      { Path: '', redirectTo: '/home', pathMatch: 'full'}, 
    
      { path: 'home', component: HomeComponent, 
        children: [ 

          // Car ************************************* 
          { 
            path: 'car', component: carComponent, 
            children: [ 

              // HelpChoose Car                    
              { 

                path: 'HelpChoose', component: HelpChooseComponent,
                children: [ 
                  { path: ':cod', component: DetailCarComponent}    

                ]
              }, 
              // KnowModel     
              { 
                path: 'KnowModel', component: KnowModelNrComponent 
              } 

            ] 
          }

        ] 

      } 

    ] 

  } 

] 

我想像 carComponent 一样显示 HelpChoose 和 knowModel。

我试过这个,但不工作。我试试这个,但不工作。

<button [routerLink]="[{ outlets: { primary: ['HelpChoose'] } }]" mat-raised-button color="primary">Find car</button>

这是路线:http://localhost:4200/home/car/HelpChoose

但是在控制台中我看到了这个错误:

Cannot match any routes. URL Segment: home/car/HelpChoose
4

0 回答 0