简体   繁体   中英

Hide query params from the url

From one component i navigate to another component and i pass some params. Also i want to pass query params but i dont want it to be seen in url. I tried using skiplocationchange but then that works but the url doesnt change when we navigate from parent to child. So i dont want to use skiplocationchange.

this._router.navigate(['/detailReports',id],{queryParams:{reportName : name},queryParamsHandling:"merge"});

So here reportName i just want it to be there in router so that i can get this prop later. But i dont want it to be shown in the url.

you can like this :

fromPage:

this.router.navigate(['/detailReports],{state:params})

toPage:

constructor(){ let params = this.router.getCurrentNavigation().extras["state"] ? this.router.getCurrentNavigation().extras["state"] : "" constructor(){ let params = this.router.getCurrentNavigation().extras["state"] ? this.router.getCurrentNavigation().extras["state"] : "" } `

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM