После слишком больших усилий я получил решение: -
URL-адрес решения : - / app / (orders: orders / (order-details: order-details))
Рабочий Stackblitz: - https://stackblitz.com/edit/angular-oac197
Конфигурация маршрута: -
RouterModule.forRoot([
{ path: "", component: LoginComponent },
{
path: "app",
outlet: "primary",
component: HomeComponent,
children: [
{
path: "orders",
outlet: "orders",
component: OrdersComponent,
children: [
{
path: "order-details",
component: OrderDetailsComponent,
outlet: "order-details"
}
]
}
]
},
{ path: "**", redirectTo: " ", pathMatch: "full" }
]
)
app.component. html
<div class="example-container">
<div mode="side" opened>
Drawer content
<button (click)="signOut()">signout</button>
</div>
<div>
<p>hello</p>
</div>
</div>
<router-outlet></router-outlet>
<button (click)="navigateToOrders()"> Go To Order </button>
<button (click)="navigateToOrderDetails()">Go To Order Details</button>
app.component.ts
import { Component } from "@angular/core";
import { Router } from "@angular/router";
@Component({
selector: "my-app",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"]
})
export class AppComponent {
name = "Angular";
constructor(private router: Router) {}
public navigateToOrders() {
this.router.navigate(["app", { outlets: { orders: ["orders"] } }]);
}
public navigateToOrderDetails() {
this.router.navigate(["app",{ outlets: {orders: ["orders", {outlets: {"order-details": ["order-details"] }}]} }]);
}
}
home.component. html
<router-outlet name="orders"></router-outlet>
orders.component. html
<p>
orders works!
</p>
<router-outlet name="order-details"></router-outlet>
order-details.component. html
<p>
order-details works!
</p>