Clear the auxiliary route before changing to another route. @angular -4.0.2
I am using the aux route for toast, toast notifications that clear a couple of seconds after successful navigation. during this time, the value router.url
is /home(aux:toast)
, and if at the same time on another route during this time the url becomes /detail(aux:toast)
, but I want to clear the aux route before going to another component.
One solution was to switch to an alternate route, which I followed.
this.router.navigate([{outlets: {aux: 'toast'}}], {skipLocationChange: true})
this didn't change the url of the address bar, but router.url
it still has/home(aux:toast)
and when navigating the same thing, the url address bar changes to /detail(aux:toast)
source to share