0

angular2,

How do I add a query query to a nested route in this format?

This works in ts file:

routerLink = ['/output', {outlets: {'output': ['details']}}] 

http://localhost:4200/#/output/(output:details)

How do I modify to add a query parm? URL should like like this:

    http://localhost:4200/#/output/(output:details;id=1)
Max Koretskyi
  • 101,079
  • 60
  • 333
  • 488
Tampa
  • 75,446
  • 119
  • 278
  • 425

1 Answers1

1

You can pass parameters as objects to URL segments like this:

router.navigate([
     '/inbox', 33, {details: true}, 'messages', 44, {mode: 'preview'}
])

So in your case it will like this:

routerLink = ['/output', {outlets: {'output': ['details', {id: 1}]}}] 
                                                           ^^^^^

this will generate the URL:

/output/(output:details;id=1)
Max Koretskyi
  • 101,079
  • 60
  • 333
  • 488