amitmahida92 / ng4-loading-spinner

Angular 4 custom async loading spinner.
MIT License
69 stars 31 forks source link

Spinner is hiding after some time. Its not waiting for hide() method? #46

Open manojcena opened 6 years ago

manojcena commented 6 years ago

I am using 1.2.3 version of the plugin.

Expected Behavior: once i call this.spinnerService.show() showing the loader fine. the loader only hide when i call this.spinnerService.hide().

CurrentBehavior: once i call this.spinnerService.show() showing the loader fine but after 5 seconds its automatically hiding. I need to hide the loader once i call hide() method.

przemyslawpedziwiatr commented 6 years ago

I've ran into the same issue - Angular 6 tested on 1.1.3 (obviously does not work) then 1.2.0 and 1.2.3 - on both loader hides itself (even though there is no .hide() method invoked).

Done nothing more than imported Ng4LoadingSpinnerModule and added to app.component then .show() from component. Tried also different attributes combinations, but any of them seemed to work.

JayCallas commented 6 years ago

I am just starting to look at this component but according to the docs, this is by design. This parameter will automatically hide the spinner after some time.

[timeout] : Accepts time in milliseconds to hide the spinner automatically. Default is 5000 ms.

I am unsure if this can be disabled but you could just set it to a crazy high number if you never want it to happen. (I personally do not see a use case for this...why would you want to hide the spinner on a long running operation before it finishes...)

manojcena commented 6 years ago

@JayCallas temporarily i did that one But i felt that is not the good solution for it. May be they should come up with solution to disable auto hiding after 5000 ms.

rrahul14 commented 6 years ago

@manojcena @JayCallas Same here...after upgrading project to angular 6. Spinner hiding after some time and its not waiting for hide method

rrahul14 commented 6 years ago

@manojcena @JayCallas I also faced the same issue. You can try this spinner https://www.npmjs.com/package/ngx-spinner it's working properly with angular 6 and have some other features

andynrkri commented 6 years ago

Hi All,

You need to set time [timeout] property in ng-loading-spinner. By default it's 5 seconds.

akhilsanker commented 6 years ago

HI @andynrkri , If I need to dismiss after getting the HTTP response, what should I do? I have a file upload and I need to dismiss only after complete posting. But now it will dismiss before completion. Thanks

liefersfl commented 5 years ago

The default for [timeout] should be 0 which should disable the timeout.

jdhines commented 5 years ago

I just came up on this same issue. I've submitted PR #49.

SanthoshSiddegowda commented 4 years ago

Add this line in your html file.

<ng4-loading-spinner [timeout]="99000">

credit: @jdhines

venkatramarajup commented 4 years ago

ngxspinner.hide() is not working in angular v9. working fine if we keep it in each child component , but if keep it as common in parent component ,the spinner is unable to hide, even though we are calling hide().

Paniraj2010 commented 4 years ago

We have same issue, ngxspinner.hide() is not working in angular v9

venkatramarajup commented 4 years ago

We have same issue, ngxspinner.hide() is not working in angular v9

Is there any alternate solution?

Paniraj2010 commented 4 years ago

try with this, if you hide spinner from ngonint() or calling from ngonint() setTimeout(() => this.spinner.show(), 25); It worked for our scenario.

venkatramarajup commented 4 years ago

try with this, if you hide spinner from ngonint() or calling from ngonint() setTimeout(() => this.spinner.show(), 25); It worked for our scenario.

if we write in ngoninit() it is working , but i want to hide() after subcribing, and show before subscribing , in this case it is not working

Paniraj2010 commented 4 years ago

try with this, if you hide spinner from ngonint() or calling from ngonint() setTimeout(() => this.spinner.show(), 25); It worked for our scenario.

if we write in ngoninit() it is working , but i want to hide() after subcribing, and show before subscribing , in this case it is not working

From where are you calling API, not from ngonint?

venkatramarajup commented 4 years ago

try with this, if you hide spinner from ngonint() or calling from ngonint() setTimeout(() => this.spinner.show(), 25); It worked for our scenario.

if we write in ngoninit() it is working , but i want to hide() after subcribing, and show before subscribing , in this case it is not working

From where are you calling API, not from ngonint?

No,not from ngoninit()

venkatramarajup commented 4 years ago

i am calling the method when button is clicked , at that point of time i am calling ngxspinner.show() , and after subscribed(result=>{this.spinner.hide()} i am calling like. this.spinner.hide() is never hidding until we press some key/button.

Paniraj2010 commented 4 years ago

i am calling the method when button is clicked , at that point of time i am calling ngxspinner.show() , and after subscribed(result=>{this.spinner.hide()} i am calling like. this.spinner.hide() is never hidding until we press some key/button.

did you try this setTimeout(() => this.spinner.hide(), 25);

venkatramarajup commented 4 years ago

i tried it worked while intial loading of the page ,but i want when i click the button

venkatramarajup commented 4 years ago

but, instead of ngx spinner, i changed from this website https://www.angularjswiki.com/angular/creating-progress-spinner-in-angular/ it worked