ngx-spinner在超时后没有隐藏。它显示了无限的时间
在app.component.ts中
import { NgxSpinnerService } from 'ngx-spinner';
constructor(private spinner: NgxSpinnerService) {}
ngOnInit(){
this.spinner.show();
setTimeout(() => {
this.spinner.hide();
}, 5000);
}
在app.component.html
中<ngx-spinner> </ngx-spinner>
答案 0 :(得分:0)
这是ngx-spinner(v7 +)最新版本的问题,在6.1.2版本中可以正常工作。
答案 1 :(得分:0)
您应该为ngx-spinner v7 +提供Spinner名称。
答案 2 :(得分:0)
我遇到了同样的问题,如果您检查您的控制台,您可能会在您的应用程序中发现此错误消息“BrowserAnimationsModule”或“NoopAnimationsModule”,这已在此线程中解决stackoverflow: How to include BrowserAnimationModule in your Angular app 如果您按照这些步骤操作,一切都会正常进行。