I have angular application where i want to pass plus sign + in query string like:
http://localhost:3000/page?name=xyz+manwal
I am using Angular 7, the + (this one "xyz+manwal") is replaced with a space (like this "xyz manwal") in the URI when it reaches to back-end code.
encodeURI() dindn't work for me, I used encodeURIComponent() it converted + to %2B
encodeURIComponent("xyz+manwal") => "xyz%2Bmanwal"
below is the example code
// filter = xyz+manwal
let filterString = encodeURIComponent(filter); // filterString = xyz%2Bmanwal
return this.http.get("http://website/query-results?" + filterString ).pipe(
retry(3),
catchError(........)
)