Reputation: 1955
<a [routerLink]="['/R1',{para:value}]">
creates links like
/link/route1/?para=value
how do I get
/link/route1/para/value
out of an a-tag?
Upvotes: 0
Views: 806
Reputation: 657118
Declare a mating parameter in the path of the route config
@Component({
selector: 'my-app',
directives: [ROUTER_DIRECTIVES],
template: `
<h2>Hello</h2>
<a [routerLink]="['/Form']">Form</a>
<a [routerLink]="['/Other', {para:'xxx'}]">Other</a>
<router-outlet></router-outlet>
`
})
@RouteConfig([
{path: '/form', name: 'Form', component: HeroFormComponent, useAsDefault: true},
{path: '/other/:para', name: 'Other', component: OtherComponent, }
])
export class App {
}
Upvotes: 2