Hello guys, I’m trying to show an Alert after Ajax call and this Alert appear twice. I dont know what I’m doing wrong.
This is my code. I call displayWelcomeAlert() after getBlogData()
constructor(public navCtrl: NavController, private BackEndDataService: BackEndData,
private globalVars: GlobalVars, private alertCtrl: AlertController) {
this.getBlogData();
}
displayWelcomeAlert(info) {
var text = jsHtmlEnc.htmlDecode(info.desc);
var websiteUrl = info.url;
let confirm = this.alertCtrl.create({
title: 'Message de Vie',
message: text,
buttons: [
{
text: 'Partager',
handler: () => {
this.share(text, websiteUrl);
}
},
{
text: 'OK',
handler: data => {
console.log('OK clicked');
}
}
]
});
confirm.present();
}
getBlogData() {
this.BackEndDataService.GetBlogInfo().subscribe(
(res) => {
this.displayWelcomeAlert(res);
})
}
Can you help?