angular - How to navigate two routers at once -
i have big problem auxiliarity router. want, every time when user try navigate main router, second router /reset page. created guard that
reset-aux.guard.ts
@injectable() export class resetauxguard implements canactivate { constructor(private router: router, private route: activatedroute) { } canactivate( next: activatedroutesnapshot, state: routerstatesnapshot): observable<boolean> | promise<boolean> | boolean { this.router.navigate(['app', {outlets: {sbr: 'reset'}}]); return true; } }
and routing file looks that:
app.routing.ts
export const routes: routes = [ { path: 'app', component: fulllayoutcomponent, data: { title: 'home' }, children: [ { path: 'page', loadchildren: './management/page/page.module#pagemodule', canactivate: [resetauxguard] }, // other routes... { path: 'page/:id', outlet: 'sbr', component: pagedetailscomponent }, { path: 'reset', outlet: 'sbr', component: resetcomponent } ] } ];
but when trying go using link:
<a class="nav-link" routerlinkactive="active" [routerlink]="['/app/page']">pages</a>
main routing stay same, example:
i'm on /app/test clicked above href , i'm redirected /app/(tests//sbr:reset) instead /app/(page//sbr:reset).
anyone can tell me did wrong?
Comments
Post a Comment