@Injectable()
export class commonLib {
loading: Loading;
constructor(
private loadingCtrl: LoadingController,
private alertCtrl: AlertController,
public modalCtrl: ModalController,
) { }
static commonAlertPopup(response_message, flag) {
let commonAlert = this.modalCtrl.create(
"CommonAlertPage",
{ alertMsg: response_message, successflag: flag },
{
showBackdrop: false,
enableBackdropDismiss: false,
leaveAnimation: "forward"
}
);
commonAlert.present();
}
}
while I define commonAlertPopup as static type then this.modalCtrl cause error : [ts] Property 'modalCtrl' does not exist on type 'typeof commonLib
Expected :
how we access this.modalCtrl.create in static method?