Dynamic alert in Ionic 2


#1

Hey, Im trying to create an alert with dynamic data that will change if I change my app language.
So it will get initialized with the correct data at the first time (dynamically, not hard coded), but when I change language, it still shows the first initialized alert.
It’s like re-using the first created alert, and not destroy and create it again…

clearSettingConfirm() {
  this.clearSettingsMessage = this.alertCtrl.create({});
  this.clearSettingsMessage.setTitle(this.translate.getParsedResult(this.globals.userLang , 'settings.clear-message-title'));
  this.clearSettingsMessage.setMessage(this.translate.getParsedResult(this.globals.userLang , 'settings.clear-message-content'));
  this.clearSettingsMessage.addButton(
      {
        text: this.translate.getParsedResult(this.globals.userLang , 'globals.cancel'),
        handler: () => {
          console.log('Cancel clicked');
        }
      });
  this.clearSettingsMessage.addButton(
      {
        text: this.translate.getParsedResult(this.globals.userLang , 'globals.clear'),
        handler: () => {
          this.globals.clearLocalStorage();
          this.logout();
        }
      });
  this.clearSettingsMessage.present();

}