I am trying to create routing in angular 2 with below scenario
home.component:
@RouteConfig([
{
path: '/',
name: 'Home',
component: HomeComponent
},
{
path: '/route1/:id',
name: 'Route1',
component: Route1Component
},
{
path: '/route2/:id/...',
name: 'Route2',
component: Route2Component
}
}]
Route2.Component:
@RouteConfig([
{
path: '/',
name: 'Route2Home',
component: Route2HomeComponent
},
{
path: '/edit',
name: 'Route2Edit',
component: Route2EditComponent
},
{
path: '/details/:otherId',
name: 'Route2Details',
component: Route2DetailsComponent
}
}]
home.html is having few links with router Links.
<a [routerLink]="['Home']">Home</a>
<a [routerLink]="['Route1', {id: 'id'}]">Route1</a>
<a [routerLink]="['Route2', {id: 'id'}]">Route2 Home</a>
<a>Route2 Edit</a>
How to configure routerLink for this? <a>Route2 details</a>
How to configure routerLink for this? Thanks.
<a [routerLink]="['/Route2', 'Route2Edit', {id: 'someValue'}]"]>Route 2 Edit</a>
<a [routerLink]="['/Route2', 'Route2Details', {id: 'someValue'}]"]>Route 2 Details</a>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.