I show a series of items that you can click to go to the next route. You can also click the popup on this page. If you click on the popup, then click on one of the elements that I would like to destroy the popup before displaying the next route.
onSelect(id) { if (this.router.url.includes('popup')) { let p = Promise.resolve(() => this.closePopup()) p.then(() => this.router.navigate(['/', id])) } else { this.router.navigate(['/', id]) } } closePopup() { this.router.navigate([{outlets: {popup: null}}]) }
I really don't understand promises, so I'm not sure I wrote it in the correct structure, but this code does not work, since it will always move along the next route with a pop-up window inside the URL. I tried to do this in the same structure beyond the promise, but it will always go to: id with (popup) still in the url.
I also tried: this.router.navigate(['/', id, {outlets: {popup: null}}]) .
Is there a function inside the router that allows absolute rewriting of the URL? Or is there a way to make sure it removes the popup from the URL before going to: id.
The problem of hope is understandable - help is much appreciated!
angular angular2-routing
lolio
source share