Want to create a text animation in Ionic


#1

So I have a text value attribute in my html. Something like this:


<div>{{value}}</div>

I want to do a type of countdown changing the value each time so I wrote some javascript in the component to change the value before arriving at the final value (so 5…4…3…2…etc.):

countdown(){

this.value = 5;
this.value = 4;
this.value = 3;
}

The JavaScript executes, but the value is changing so quickly that the view doesn’t update until after the method finishes. Is there a better way to do this? Can I force the redraw between values being set or is there some kind of async code I should be using?