Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- */my-account/overview // homepage
- */my-account/my-stuff
- */profile
- */non-default
- export const routes: Routes = [
- { path: '', redirectTo: 'my-account', pathMatch: 'full' }, // should redirect to localhost:4200/my-account
- { path: '', component: DefaultComponent, children: [
- { path: 'my-account', children: [
- { path: '', redirectTo: 'overview', pathMatch: 'full' }, // should redirect to localhost:4200/my-account/overview
- { path: 'overview', component: OverviewComponent }, // should resolve: localhost:4200/my-account/overview
- { path: 'my-stuff', component: MyStuffComponent } // should resolve: localhost:4200/my-account/my-stuff
- ]},
- { path: 'profile', component: ProfileComponent } // should resolve: localhost:4200/profile
- ]},
- { path: 'non-default', component: NonDefaultComponent } // should resolve: localhost:4200/non-default
- ];
- <nav>
- <ul>
- <li *ngFor="let menuItem of menuItems">
- <a [routerLink]="menuItem.url">
- <div>{{ menuItem.label }}</div>
- </a>
- </li>
- </ul>
- </nav>
- <nav>
- <ul>
- <li *ngFor="let menuItem of menuItems">
- <a routerLink="menuItem.url">
- {{ menuItem.label }}
- </a>
- </li>
- </ul>
- </nav>
Add Comment
Please, Sign In to add comment