Masum ULU
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
6 additions and
9 deletions
-
npm/ng-packs/packages/core/src/lib/services/router-events.service.ts
|
|
|
@ -34,15 +34,12 @@ export class RouterEvents { |
|
|
|
} |
|
|
|
|
|
|
|
protected listenToNavigation(): void { |
|
|
|
( |
|
|
|
this.router.events.pipe( |
|
|
|
filter(e => e instanceof NavigationEvent.End && !e.url.includes('error')), |
|
|
|
) as Observable<NavigationEnd> |
|
|
|
).subscribe(event => { |
|
|
|
// It must be "NavigationTransition" but it is not exported in Angular
|
|
|
|
//https://github.com/angular/angular/blob/9c486c96827a9282cbdbff176761bc95554a260b/packages/router/src/navigation_transition.ts#L282
|
|
|
|
|
|
|
|
this.#previousNavigation.set(this.#currentNavigation()); |
|
|
|
const routerEvent$ = this.router.events.pipe( |
|
|
|
filter(e => e instanceof NavigationEvent.End && !e.url.includes('error')) |
|
|
|
) as Observable<NavigationEnd>; |
|
|
|
|
|
|
|
routerEvent$.subscribe(event => { |
|
|
|
this.#previousNavigation.set(this.currentNavigation()); |
|
|
|
this.#currentNavigation.set(event.url); |
|
|
|
}); |
|
|
|
} |
|
|
|
|