Created
April 6, 2018 07:59
-
-
Save jagomf/bbf9976adb06d8c45bfeec49d0224a09 to your computer and use it in GitHub Desktop.
Nested routes in Angular 2+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
{ path: 'wall', component: WallHandlerComponent, canActivate: [LoggedGuard], | |
children: [ | |
{ path: '', redirectTo: 'recent', pathMatch: 'full' }, | |
{ path: 'recent', component: RecentEventsComponent }, | |
{ path: 'ranking', component: RankingUsersComponent } | |
] }, | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<nav mat-tab-nav-bar> | |
<a mat-tab-link | |
*ngFor="let link of wallNavLinks" | |
[routerLink]="link.path" | |
routerLinkActive #rla="routerLinkActive" | |
[active]="rla.isActive"> | |
{{link.label}} | |
</a> | |
</nav> | |
<router-outlet name="walloutlet"></router-outlet> | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
get wallNavLinks(): { label: string, path: any[] }[] { | |
return [ | |
{ label: 'Recent', path: 'recent' }, | |
{ label: 'Ranking', path: 'ranking' } | |
]; | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment