I am fetching query parameter from url through ActivatedRoute
queryParams
method.It is working fine for normal string.But If I have '&' inside the query value,then it's split the value from '&' and getting the string before the '&' position.Example is below:
http://localhost:4200/#/test/APP?cat1=APP1&cat2=A&B%20Test=&cat3=Service
this is the url from which I'm fetching the cat1
,cat2
,,cat3
value.
constructor(private actRoute: ActivatedRoute){
}
this.actRoute.queryParams.subscribe(params => {
this.catName1 = params['cat1'];
this.catName2 = params['cat2'];
this.catName3 = params['cat3'];
console.log(this.catName1, this.catName2);
})
this.catName1
is printing APP1
but this.catName2
is printing only A
, rest of the part is omitted.How to get the whole this.catName2
value as A&B Test
. I already tried with encodeURI()
function but nothing happened.