Version "@ angular / router": "^ 3.3.1"
I just provide the name of the route that I declare in my app.route.ts
import { ModuleWithProviders } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { HomeComponent } from './home/home.component'; import { DeclarationsComponent } from './declarations/declarations.component'; const appRoutes: Routes = [ { path: '', pathMatch: 'full', component: HomeComponent }, { path: 'declarations', pathMatch: 'full', component: DeclarationsComponent } ]; export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
And in the view, I just write the name of the route
<ul class="nav navbar-nav"> <li routerLinkActive="active"><a routerLink="">Home</a></li> <li><a routerLink="declarations">SAV</a></li> </ul>
Shigiang Liu Jan 27 '17 at 16:26 2017-01-27 16:26
source share