Dynamic Message for Alerts

We use AlertController to make a countdown message, this is a real simple example:

let countdown: number = 5;

let toast = this.toastCtrl.create({
    message: 'Write the countdown:' + countdown,
    duration: countdown * 1000
});
toast.present();

This is working fine, but we wont do make the MESSAGE dynamically see the real countdown in the alert message. Probably for this we need to remove the duration and implement something like an Observable.interval which dismiss the Toast after the countdown time and change the message title on any time interval.

The only thing wee need is the message for the toast should have a change detection for the message or something like that.

Is there a workaround we can do this, if not I’ll open a new feature request on ionic github

1 Like

Hey @mburger81!

Did you solve it?

Thanks.

No I don’t and I never got a hint for doing this. I think for now this is not possible out of the box. Perhpase someone can make a PR for that?

create(…) returns a Toast instance.

There is a setMessage, perhapse this could work?

Yeah, good idea with setMessage (and working)!

Thanks!