Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interceptor Support #275

Open
kesavamoorthi-gk opened this issue Feb 16, 2024 · 1 comment
Open

Interceptor Support #275

kesavamoorthi-gk opened this issue Feb 16, 2024 · 1 comment

Comments

@kesavamoorthi-gk
Copy link

Instead of incorporating NgxSpinnerService individually in each component, implement a feature to utilize NgxSpinnerService within an Interceptor to eliminate redundancy.

@Et3rnal
Copy link

Et3rnal commented Apr 29, 2024

You don't need to add it to every component, just add it to your AppComponent and enable it on router events

eg:

    ngOnInit() {
        this.router.events.pipe(
            filter(
                (e) =>
                    e instanceof NavigationStart ||
                    e instanceof NavigationEnd ||
                    e instanceof NavigationCancel ||
                    e instanceof NavigationError
            ),
            map((e) => e instanceof NavigationStart)
        ).pipe(
            //takeUntil(this.Destroy$),
            //delay(100)
            )
            .subscribe(
                isRouteLoading => {
                    this.isLoading = isRouteLoading;
                },
            );
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants