In my root component, I have the following template:
<main class="main">
<div class="main__container">
<div class="main__left-area">
<router-outlet></router-outlet>
</div>
<div class="main__right-area">
<router-outlet name="aside"></router-outlet>
</div>
</div>
</main>
I would like to load some components in the primary router-outlet
and some other components in the secondary router-outlet
for the same route (and of course, I have several routes). Therefore, I defined my routes like this:
export const AppRoutes: Routes = [
{
path: "",
component: HomeSummaryComponent
},
{
path: "",
component: AskSummaryComponent,
outlet: "aside"
},
{
path: "payments",
component: PaymentComponent
},
{
path: "payments",
component: DataSummaryComponent,
outlet: "aside"
}
];
When the page loads, it works well, I have the HomeSummaryComponent
in the primary router-outlet
and the AskSummaryComponent
in the aside router-outlet
. However, in the navigation, I have this:
<a routerLink="/payments" class="navigation__link">Payments</a></span>
When I click on this link, the content of the primary router-outlet
gets replaced by the PaymentComponent
but the aside router-outlet
still displays AskSummaryComponent
.
I also tried to rename the second "payments" route by "/payements-aside" and replace the link with:
<a routerLink="/payments(aside:payments-aside)" class="navigation__link">Payments</a>
But it still does not work. However, when I directly access http://localhost:8083/payments(aside:payments-aside)
, it does work but this URL is not really clean... It can't be used for a public facing web site because.
Does anyone have an idea about how to realize this simple need?