Skip to content

Commit b106b7c

Browse files
committed
feat(navigation): added delay for loader hide
1 parent 4e7b8bd commit b106b7c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/app/app.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Actions, createDispatchMap, ofActionSuccessful, select } from '@ngxs/store';
22

3-
import { take } from 'rxjs';
3+
import { take, timer } from 'rxjs';
44

55
import { ChangeDetectionStrategy, Component, DestroyRef, effect, inject, OnInit } from '@angular/core';
66
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@@ -67,7 +67,9 @@ export class AppComponent implements OnInit {
6767
event instanceof NavigationCancel ||
6868
event instanceof NavigationError
6969
) {
70-
this.loaderService.hide();
70+
timer(500)
71+
.pipe(takeUntilDestroyed(this.destroyRef))
72+
.subscribe(() => this.loaderService.hide());
7173
}
7274

7375
if (this.environment.googleTagManagerId && event instanceof NavigationEnd) {

0 commit comments

Comments
 (0)