import { Injectable } from '@angular/core';
import { LoadingController } from '@ionic/angular';
@Injectable({
providedIn: 'root'
})
export class LoadingService {
constructor(private readonly loadingController: LoadingController) { }
async show(message: string) {
const top = await this.loadingController.getTop();
if (top) {
top.remove();
}
const loading = await this.loadingController.create({
message,
});
loading.present();
return loading;
}
dismiss(id?: string) {
this.loadingController.dismiss({id})
}
}