Jayant Pareek
Jayant Pareek

Reputation: 370

What should be an equivalent [routerLink] code for this.router.navigate code?

   showBio(id) {
  this.router.navigate(['/speakers', {outlets: {'bio': [id]}}]);
}

How can I write it in [routerLink] and still can pass an id? I am following this example for reference: Example

Upvotes: 3

Views: 4527

Answers (1)

AngularChef
AngularChef

Reputation: 14077

The route syntax stays the same with [routerLink] :

<a [routerLink]="['/speakers', {outlets: {'bio': [id]}}]">Link</a>

For this to work, the id property needs to be exposed to your template.

Upvotes: 2

Related Questions