标签:nts htm config border save from style ror radius
使用npm安装ngx-loading模块
npm install --save ngx-loading
在app.module.ts中导入模块
import { BrowserModule } from ‘@angular/platform-browser‘; import { NgModule } from ‘@angular/core‘; import { NgxLoadingModule } from ‘ngx-loading‘; @NgModule({ ... imports: [ ...
...
],
...
})
export class AppModule { }
在对应的component.ts文件中增加loading属性
export class *Component implements OnInit { loading = false; ... get*Data(): void { this.loading = true; this.*Service.getData(url).subscribe(res => { ... this.loading = false; ... }, error => { ... this.loading = false; ... }); } }
最后,在html文件中加入下列代码即可:
<ngx-loading [show]="loading" [config]="{ backdropBorderRadius: ‘14px‘ }"></ngx-loading>
标签:nts htm config border save from style ror radius
原文地址:https://www.cnblogs.com/lucky-heng/p/10982445.html