0

Like:

/profiles/:category/:profileSlug/:page

Because I cannot generate URL with [routerLink]="['/profiles', {category: 'president', profileSlug: 'obama', page: 1}]" returns unexpected result in matrix query format

So in Router3 I must hard the whole URL by myself? If true then Angular's router is really...

tom10271
  • 4,222
  • 5
  • 33
  • 62

2 Answers2

2

You don't name the parameters in your routerLink attribute, just pass in the values:

[routerLink]="['/profiles', 'president', 'obama', 1]"

For /profiles/:id/edit:

[routerLink]="['/profiles', id, 'edit']"
tom10271
  • 4,222
  • 5
  • 33
  • 62
nickspoon
  • 1,347
  • 12
  • 18
0
[routerLink]="[/profiles", {queryParams: {category:'president', profileSlug:'obama',page:1}}]"

I think this is the correct way to implement multiple required parameters

Alexis Le Gal
  • 327
  • 4
  • 11
  • 1
    Queryparameters are something different. They are the part after `?` (or `;`) in the URL. The route parameters used in the question are part of the path of the URL. – Günter Zöchbauer Aug 31 '16 at 09:46