我正在为我的Angular 7项目使用NGX UI加载器。
在 app.module.ts 文件中,我已经导入了ngx-ui-loader包装: -
import { NgxUiLoaderModule, NgxUiLoaderHttpModule, NgxUiLoaderConfig, SPINNER, POSITION, PB_DIRECTION } from 'ngx-ui-loader';
然后,我创建了这样的常数来定义配置参数: -
const ngxUiLoaderConfig: NgxUiLoaderConfig = {
bgsColor: 'red',
bgsPosition: POSITION.bottomCenter,
bgsSize: 40,
bgsType: SPINNER.rectangleBounce,
pbDirection: PB_DIRECTION.leftToRight, // progress bar direction
pbThickness: 5, // progress bar thickness
};
然后在@NgModule
NgxUiLoaderModule.forRoot(ngxUiLoaderConfig)
在 app.component.html 文件中,我在<router-outlet></router-outlet>
标签上方添加了<ngx-ui-loader></ngx-ui-loader>
标签。
在 app.component.ts 文件中,我保留了以下代码
import { NgxUiLoaderService } from 'ngx-ui-loader';
export class AppComponent implements OnInit{
title = 'medico';
constructor(private ngxService: NgxUiLoaderService) { }
ngOnInit() {
this.ngxService.start(); // start foreground spinner of the master loader with 'default' taskId
// Stop the foreground loading after 5s
setTimeout(() => {
this.ngxService.stop(); // stop foreground spinner of the master loader with 'default' taskId
}, 300);
}
}
当我运行页面时,我可以看到加载程序。问题是,即使在更改app.module.ts中的配置数据之后,加载程序属性也不会更改。
我在做什么错?
注意:请不要提出建议:"为什么不使用其他加载程序,例如http-loader等"。问题是关于为什么NGX UI加载器无法正常工作。
您需要将BGS的所有实例更改为FGS,因此BGSCOLOR应该是FGSCOLOR。
默认情况下,唯一可见的旋转器似乎是前景旋转器和进度栏。
希望有帮助