Ionic Agular Loading page

agnusdei·2023년 7월 5일
0
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})
  }
}

0개의 댓글