I have this working implementation af a angularJS app which fetches some links from an URL and paint them. However the links on the URL are being updated constantly, I would like to update periodcially this $scope.listlinks, let say every 10 seconds.
I tried playing with setInterval with no luck.
Javascript
var App = angular.module('App', []);
App.controller('ListLinksCtrl',
function get($scope, $http ) {
$http.get('http://example_url.com/my_changing_links_json').then(
function(res){$scope.listlinks = res.data;});
}
);
HTML
<div id="cnt1" ng-controller="ListLinksCtrl">
<div ng-repeat="singlelink in listlinks">
<a href="{{ singlelink.url }}">
{{ singlelink.destination }}
</a>
</div>
</div>
See Question&Answers more detail:os