0
votes

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

1

1 Answers

0
votes

I think this is what you need:

<a [routerLink]="['/EmployeeData']" [queryParams]="{name:foo}">Security Dashboard</a></li>