Nebular: nb-global-spinner keeps on showing

Created on 21 Feb 2019  路  4Comments  路  Source: akveo/nebular

Issue type

I'm submitting a ... (check one with "x")

  • [x ] bug report
  • [ ] feature request

Issue description

Current behavior:

nb-global-spinner doesnt hide
Expected behavior:

nb-global-spinner should disapear

Other information:

Please explain what should trigger global-spinner display set to none

theme needs docs

Most helpful comment

I also couldn't figure out why some routes would hide the spinner and others wouldn't so I went digging into the nebular code. For posterity, here's what I found:

NbLayoutComponent injects the NbSpinnerService and calls load() inside the the constructor.

NbLayoutComponent has nb-layout as a selector. So if you're not using nb-layout it won't get triggered, and therefore the spinner won't get cleared.

All 4 comments

Hi @batousik, you can inject NbSpinnerService and call load method, to trigger all registered loaders (if any). This should hide the global spinner.

Hi guys,
I could solve this problem using the following code.

 constructor(private spinner$: NbSpinnerService ) { }

  ngOnInit() {
    this.spinner$.load();
  }

I also couldn't figure out why some routes would hide the spinner and others wouldn't so I went digging into the nebular code. For posterity, here's what I found:

NbLayoutComponent injects the NbSpinnerService and calls load() inside the the constructor.

NbLayoutComponent has nb-layout as a selector. So if you're not using nb-layout it won't get triggered, and therefore the spinner won't get cleared.

I found a solution

Inject private cdr: ChangeDetectorRef

constructor( private cdr: ChangeDetectorRef ) {

run detect changes after changing the spinner

timer(2000).subscribe(() => { this.isSpinLoading = false; this.cdr.detectChanges(); });

Was this page helpful?
0 / 5 - 0 ratings