6

I have console.log correctly showing the route with customer? however, with the [RouterLink] it is converting it from ? to %3F in which my route no longer works

template html

  <a [routerLink]="[items.Url]">

Route file

 { path: 'customer', component: CustomerComponent, pathMatch: 'full'},

Can I correct this somehow with the template .. routerLink (some pipe filter?) or can or does this have to be fixed in my route module ts file?

HOW?

I need

 http://server/customer?  

but i'm getting

 http://server/customer%3F  
  • May I ask why you need to add the question mark at the end? If you are building up query parameters, Angular will add the question mark automatically when you specify the parameters. – DeborahK Dec 15 '17 at 23:38
  • 2
    Router link is expecting a list of route segments, not a URL. – DeborahK Dec 15 '17 at 23:53

1 Answers1

2

You can set query parameters with router link:

<a [routerLink]="[items.url]"
   [queryParams]="{myParam: 'myParamValue'}"
>

This will result in a route as follows:

/server/customer?myParam=myParamValue

Tiha
  • 598
  • 6
  • 10