How to run http.get every x seconds in ionic2

Hi guys, is there someone can help me how to How to run http.get every x seconds in ionic2?
So I can get the updates json from remote server.

Thank you

just make a recursive methode that calls itself something like this:

        `public getAll() {
         vare me =this;
         setTimeout(function(){
         return me.http.get(this.url, me._options);
         me.getAll()
         },2000)`

this will run every 2 seconds
but also remember it is always good to have a condition to break the loop.

also if this looses reference to the this object you can always pass it as an argument

1 Like

Thank you Sgouromallis. It’s worked!