My problem is that I don't know how to do a setInterval in Ionic3. I have put in the .ts of my page the following:
export class ClickerPage {
public dinero=0;
public produccion=1;
constructor(public navCtrl: NavController) {
setInterval(function(){
this.dinero+=this.produccion;
}, 1000);
}
...
And in the view I used:
<ion-item>
<ion-icon name="cash" item-start></ion-icon>
Dinero:
<ion-badge item-end>{{dinero}}</ion-badge>
</ion-item>
But it doesn't work, it just doesn't get updated, I don't know if it goes in the constructor like I did, or the setInterval goes somewhere else. Can you help me? Thank you!
For those who are interested, I managed to solve the problem with the following: