@imatefx wrote:
I have an external class AlertHelper which contains predefined Alerts for Error and Success events.
when an event occurs i call the service function which returns an alert object and i present it using the nav in the related page.@Injectable() export class AlertHelper { showLoadingFailedAlert(): Alert { let alert = Alert.create({ title: '_title', subTitle: '_subTitle', buttons: [{ text: 'Ok', handler: () => { console.log('Ok clicked'); } }] }); return alert; } }
i call it like
this.nav.present(this.alertHelper.showLoadingFailedAlert());
My problem is
Typescript shows the following error:Argument of type 'Alert' is not assignable to parameter of type 'ViewController'.
Some places it shows
Argument of type 'Alert' is not assignable to parameter of type 'ViewController'. Types have separate declarations of a private property '_cntDir'.
It works fine if i create an Alert locally.
Also Is there any possible way for me to pass the nav to the service so that the service can present the alert?
Posts: 8
Participants: 2