I am calling an alert on my Page.
addError(title,message){
const alert = this.alertCtrl.create({
'title': title,
'subTitle': message,
'buttons': ['OK']
});
alert.present();
}
Html Code with content including button and textbox.
<ion-content padding>
<ion-list>
<ion-item>
<ion-label fixed>Name</ion-label>
<ion-input type="text" [(ngModel)]="name"></ion-input>
</ion-item>
<ion-item>
<ion-label fixed>Secret</ion-label>
<ion-input type="text" [(ngModel)]="secret"></ion-input>
</ion-item>
</ion-list>
<div padding>
<button ion-button color="primary" (click)="add();" block>Add New</button>
</div>
</ion-content>
The Entire .ts code is given below with class definition
class HomePage {
name:string;
secret:string;
constructor(public navCtrl: NavController,public alertCtrl: AlertController,public strorage:StorageServiceProvider) {
}
addError(title,message){
const alert = this.alertCtrl.create({
'title': title,
'subTitle': message,
'buttons': [{
text: "Cancel", handler: () => {
alert.dismiss();
return false;
}
}]
});
alert.present();
}
add(){
if(this.name && this.secret){
this.strorage.addNew({'name':this.name,'secret':this.secret});
}
else{
this.addError("Error","Please enter Secret name and Secret");
}
}
}
I am getting the following error while I am calling the addError again.
Uncaught (in promise): removeView was not found