0
votes

So, my app scheme looks like this. There is a primary outlet divided into two auxiliary outlets- Sidenav outlet and Content outlet which load two different modules.

enter image description here

My issue is, I can't figure out how to change routing (Using routerLinks) of Sidenav outlet using Content outlet and vice versa. Also, I would like to manipulate two routes at once, which does not seem to work as well with what I tried so far.

I've tried using this

<a [routerLink]="['/home', { outlets: { 'sidenav': ['/some/route'], 'content': ['/some/other_route'] } } ]">Navigate</a>

But it does not work, I get the error as routes would not exist (Though I can set them just by editing the path at the top of the browser).

My wild guess is that [routerLink] placed inside of Content Outlet searches for child outlet named sidenav, instead of its peers. But I have no idea how to make a workaround.

EDIT: My routing file looks something like this

const routes: Routes = [ { path: 'core', component: CoreComponent, children: [ { path: 'some', outlet: 'sidenav', loadChildren: () => import('...').then( (m) => m.Module ) }, { path: '', redirectTo: 'some', outlet: 'sidenav', pathMatch: 'full' }, { path: 'some_different', outlet: 'content', loadChildren: () => import('...').then( (m) => m.Module ) }, { path: '', redirectTo: 'some_different', outlet: 'content', pathMatch: 'full' } ] }, { path: '', redirectTo: 'core', pathMatch: 'full' } ];

In each child module there are just ordinary routes with nothing special.

1
can you show your routing file?Palak Jadav
@JadavPalak just editedJan Paweł Niepsuj

1 Answers

0
votes

You could use the "data" object in your angular routes "root or childs" to read some specific Information. Maybe this will help you out.