有角嵌套命名出口路径

问题描述 投票:0回答:1

您好,我试图将我的出口路线嵌套在角度9中。每当我转到http://localhost:4200/app/(orders:orders)/(order-details:/order-details)时,我都会重定向到http://localhost:4200/app/(orders:orders),以尝试查看可以在其中看到订单列表的视图,然后在单击订单时显示另一个包含订单详细信息的视图。感谢帮助routes.ts

const routes: Routes = [
  { path: '', component: LoginComponent },
  {
    path: 'app',
    component: HomeComponent,
    runGuardsAndResolvers: 'always', canActivate: [AngularFireAuthGuard],
    children: [
      {
        path: 'orders', component: OrdersComponent, outlet: 'orders',
        children: [
          {
            path: 'order-details', component: OrderDetailsComponent, outlet: 'order-details',
          }
        ]
      }
    ]
  },
  { path: '**', redirectTo: '', pathMatch: 'full' }
];

home.component.html

<mat-drawer-container class="example-container">
    <mat-drawer mode="side" opened>
        Drawer content
        <button (click)="signOut()">signout</button>
    </mat-drawer>
    <mat-drawer-content>
        <p>hello</p>
        <router-outlet name="orders"></router-outlet>
        <router-outlet name="order-details"></router-outlet>
    </mat-drawer-content>
</mat-drawer-container>
javascript angular angular-routing
1个回答
0
投票

[<router-outlet name="order-details"></router-outlet>在订单组件中移动它。

© www.soinside.com 2019 - 2024. All rights reserved.