安装ngx-loading插件

npm install --save ngx-loading

在应用程序的主module中导入ngx-loading模块

import {NgxLoadingModule} from 'ngx-loading';

...

imports:[

...

NgxLoadingModule

...

]

使用

在子页面html模板中加入:

<ngx-loading [show]="loading" [config]="{ backdropBorderRadius: '14px' }"></ngx-loading>

在ts代码中设置loading成员控制等待框是否显示

loadData(pageIndex: number, pageSize: number) {

this.loading = true;

this.dataService.httpGet(url地址).map(res => res.text()).subscribe(

res => {

//从服务端获取数据成功,处理数据

}

this.refreshStatus();

this.loading = false;

}

, error => {

this.error = error;

this.loading = false;

});

}

angular6的等待提示框

相关文章:

  • 2021-09-01
  • 2022-02-07
  • 2021-08-14
  • 2022-12-23
  • 2021-05-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-21
  • 2021-10-21
  • 2022-02-02
  • 2022-02-01
  • 2021-08-13
  • 2022-12-23
  • 2021-06-15
相关资源
相似解决方案