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
  • 8,172
  • 5
  • 33
  • 43
CruelEngine
  • 2,701
  • 4
  • 23
  • 44

1 Answers1

0

I think this is what you need:

<a [routerLink]="['/EmployeeData']" [queryParams]="{name:foo}">Security Dashboard</a></li>
Philipp Kief
  • 8,172
  • 5
  • 33
  • 43