0

I was working on router in angular 2. My URL has the following parameters for example: www.hi.com?name=foo,bar

I want to pass the parameter data to my route as I want to filter some data based on 'name'.

<ul>
    <li><a [routerLink]="['/NewPage']">NewPage</a></li>
    <li><a [routerLink]="['/EmployeeData']">Security Dashboard</a></li>
</ul>
<div>
    <router-outlet></router-outlet>
</div>

I want the parameter to be used in the route as /EmployeeData?name=foo,bar

How can I achieve this ?

Thanks in Advance

Philipp Kief
  • 7,072
  • 4
  • 34
  • 42
CruelEngine
  • 2,471
  • 4
  • 19
  • 40

1 Answers1

0

I think this is what you need:

<a [routerLink]="['/EmployeeData']" [queryParams]="{name:foo}">Security Dashboard</a></li>
Philipp Kief
  • 7,072
  • 4
  • 34
  • 42