Ionic 2 : Set interval
this.task = setInterval(() => {
this.refreshData();
}, 300);
or store context like this
let self = this;
this.task = setInterval(function () {
self.refreshData();
}, 300);
or using bind
this.task = setInterval((function () {
this.refreshData();
}).bind(this), 300);
if only one function call:
this.task = setInterval(this.refreshData.bind(this), 300);
you could learn more about this with https://github.com/getify/You-Dont-Know-JS/tree/1st-ed/this%20%26%20object%20prototypes/ch1.md
You should use setInterval() with => arrow, as I mentioned below
setInterval(() => {
console.log('timer');
//you can call function here
},5000);
100% working.