R
R
RSalo2020-03-07 01:01:50
JavaScript
RSalo, 2020-03-07 01:01:50

Angular Outlet reset when going back to root?

Hello. I'm trying to figure out the outlets and there's a problem. There are routes:

{path: '.', component: AppComponent},
  {path: 'test-route', component: TestComponentComponent, outlet: 'sidebar'},
  {path: 'other', component: OtherComponent},

And the output in the component:
<button [routerLink]="[{outlets: {sidebar: ['test-route']}}]">Button</button>
<a [routerLink]="['other']">other</a>
<a [routerLink]="['.']">main</a>
<router-outlet></router-outlet>
<router-outlet name="sidebar"></router-outlet>

If we click on the button, then the outlet will be shown both for the root and when going to other. The problem is that when you go to the main page (main) by reference, the outlet is reset. How to win it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question