I have this router link:
<a [routerLink]="['RepairReturnListing', {country: someVal}]">Test</a>
In my component I define someVal like this:
export class RepairReturnCountByCountry {
...
someVal: number = 1;
...
}
When the value is 1 I get this URL:
http://localhost:54675/repairReturnListing?country
Notice, no equals sign and no value.
I display the value in a div and it works as expected.
<div>{{someVal}}</div>
If I change it to anything other than one (even -1) I get a valid URL:
http://localhost:54675/repairReturnListing?country=0
http://localhost:54675/repairReturnListing?country=2
http://localhost:54675/repairReturnListing?country=777
http://localhost:54675/repairReturnListing?country=-1
If I remove someVal from the component I get:
http://localhost:54675/repairReturnListing?country=null
I change someVal to a string but I get the same results:
someVal: string = '1';
Here is my routeConfig:
@RouteConfig([
{ path: '/repairReturnListing', name: 'RepairReturnListing', component: ListingComponent, useAsDefault: false }
])