Refresh / re-load factory / service every 10 seconds

Hey guys :smile:

I am aware that this is an Angular query and not so much an Ionic query, but I know there are a lot of skilled Angular guys here :smile:

I’m wondering how I can refresh data in a view every 10 seconds or so? My controller references a Factory which makes a HTTP call to get data from a server, standard stuff nothing funny here. Then I display the data on the view, everyone happy…

But I’d like to be able to refresh this without the user having to do anything (click a button, interact in any way).

How does one achieve that?

As always, many thanks to anyone for their help :smile:
Ed

Sounds like a job for the amazing super $interval?

1 Like

$timeout( $scope.loadData ,10000);

See this very old example.

1 Like

thanks bro for this sample