2

I'm trying to get the url for some component.

Firstly I'm trying to get URL tree by calling:

router.createUrlTree(['Dashboard'])

After that I'm calling toString method to get url for calling the component, but I get following string:

"/pages;0=Dashboard"

I don't understand where does ;0= part come from? What is it? Anybody have explanation?

I defined pages route and dashboard as child of the pages route.

Neir0
  • 12,849
  • 28
  • 83
  • 139
  • It's a matrix parameter, which mean it's a query parameter of a child route. – Günter Zöchbauer Jan 09 '17 at 17:20
  • @GünterZöchbauer Intersting, looks like an inner representation. I really expected to see just a normal human readable url. – Neir0 Jan 09 '17 at 18:45
  • That's a normal readable URL http://stackoverflow.com/questions/2048121/url-matrix-parameters-vs-request-parameters – Günter Zöchbauer Jan 09 '17 at 18:45
  • @GünterZöchbauer Got it. Does it mean route.toString() by default use matrix parameters form? Are there are any way to get request parameters form from the route? – Neir0 Jan 09 '17 at 18:52
  • As mentioned in my first comment, matrix parameters are query parameters added to child routes. If query parameters are added to the root root, they are added as `/pages?0=Dashboard`. I don't know what you are doing exactly and therefore can't tell where this parameter comes from. – Günter Zöchbauer Jan 09 '17 at 18:53
  • Try `router.createUrlTree(['/Dashboard'])` – Günter Zöchbauer Jan 09 '17 at 18:54

0 Answers0