Files
doneit-web/src/app/services/loading.service.ts
T

36 lines
841 B
TypeScript
Raw Normal View History

2020-08-27 15:55:10 +01:00
import { Injectable } from '@angular/core';
import { LoadingController } from '@ionic/angular';
@Injectable({
providedIn: 'root'
})
export class LoadingService {
2020-12-15 19:37:42 +01:00
loading:any;
2020-08-27 15:55:10 +01:00
constructor(public loadingController: LoadingController) { }
2020-12-15 19:37:42 +01:00
async simpleLoading() {
this.loading = await this.loadingController.create({
2020-08-27 15:55:10 +01:00
cssClass: 'my-custom-class',
2020-12-15 19:37:42 +01:00
message:'A carregar!...',
2020-08-27 15:55:10 +01:00
duration: 2000
});
2020-12-15 19:37:42 +01:00
await this.loading.present();
2020-08-27 15:55:10 +01:00
}
async customizedLoading() {
const loading = await this.loadingController.create({
cssClass: 'my-custom-class',
spinner: null,
duration: 5000,
message: 'Click the backdrop to dismiss early...',
translucent: true,
backdropDismiss: true
});
await loading.present();
const { role, data } = await loading.onDidDismiss();
}
}