Im navigating after building up a queryParams object with a form:
options {
...
words: (4) ["chuck", "norris", "vs", "keanu", "reeves"]
}
Then navigate with that object to update the URL's parameters:
this.router.navigate(['/search'], { queryParams: options });
The URL words param is duplicated for each entry like this:
/search?words=chuck&words=norris&words=vs&words=keanu&words=reeves
How do we pass in an array to queryParams properly?
Links: angular.io/api/router/Router#navigate alligator.io/angular/query-parameters
queryParamsHandling has no affect on this. Here is a StackBlitz repro.
words? It could work like this :) From en.wikipedia.org/wiki/Query_string#Structure : "While there is no definitive standard, most web frameworks allow multiple values to be associated with a single field (e.g. field1=value1&field1=value2&field2=value3)." Another benefit is that you will automatically have an array of the query parameters inside the angular router state. So you don't have to manually parse the querystring.(4)before the array of words add to the code? I have never come across this syntax in Typescript.