Handling query parameters with multiple question marks in Angular 2 -


so couldn't correct result query parameters. example have query parameter looks this:

?encryptedid=zxcvbnm?:112233 

the returned result zxcvbnm, second question mark , succeeding characters omitted.

i've tried this:

this.businessid = this.router.parseurl(this.router.url).queryparams["bid"]; 

and this:

this.activatedroute.queryparams.subscribe((queryparams: params) => {       this.businessid = queryparams['id'];     });  

but both codes return same result. want capture everything. please help. thanks!

you need encode before passing url encodeuricomponent

can try encodeuricomponent('zxcvbnm?:112233') on browser console , see result.

so ?encryptedid=zxcvbnm?:112233 become ?encryptedid=zxcvbnm%3f%3a112233

then component, can retrieve following. have tested it.

export class queryparamscomponent implements oninit {     constructor(         private router: router,         private route: activatedroute) {     }      ngoninit() {         let queryparams = this.route.snapshot.queryparams;         const encryptedid = queryparams['encryptedid'];     } } 

Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -