无法从 app.module.ts 文件配置 ngx-ui-loader [英] Can't configure ngx-ui-loader from app.module.ts file

查看:18
本文介绍了无法从 app.module.ts 文件配置 ngx-ui-loader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的 angular 7 项目使用 ngx ui loader.

I am using the ngx ui loader for my angular 7 project.

app.module.ts 文件中,我像这样导入了 ngx-ui-loader 包:-

In the app.module.ts file, I have imported the ngx-ui-loader package like this:-

import { NgxUiLoaderModule, NgxUiLoaderHttpModule, NgxUiLoaderConfig, SPINNER, POSITION, PB_DIRECTION } from  'ngx-ui-loader';

然后我创建了一个这样的常量来定义配置参数:-

Then I created a constant like this to define the configuration parameters:-

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

app.component.html 文件中,我添加了 <ngx-ui-loader></ngx-ui-loader> 标签 标签.

In the app.component.html file, I have added the <ngx-ui-loader></ngx-ui-loader> tag just above the <router-outlet></router-outlet> tag.

app.component.ts文件中,我保留了以下代码

In the app.component.ts file, I kept the following code

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 中的配置数据,loader 属性也不会更改.

When I am running the page, I can see the loader. The issue is, even after changing the configuration data in the app.module.ts, the loader property doesn't change.

我做错了什么?

注意:请不要给出诸如为什么不使用其他加载器,如 http-loader 等"之类的建议.问题是为什么 ngx ui 加载器没有按预期工作.

Note: Please don't give suggestions like "why don't you use other loader like http-loader, etc". The question is about why the ngx ui loader isn't working as expected.

推荐答案

需要把bgs的所有实例都改成fgs,所以bgsColor应该是fgsColor.

You need to change all instances of bgs to fgs, so bgsColor should be fgsColor.

默认情况下,唯一可见的微调器似乎是前景微调器和进度条.

By default, the only spinner viewable appears to be the forground spinner and the progress bar.

希望有帮助

这篇关于无法从 app.module.ts 文件配置 ngx-ui-loader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆