I'm trying to run an http request on interval maybe every 1 minute, so that I could get notifications seemingly realtime (no time to implement web sockets).. my qeustion is how do i associate the view to the the http call.. I'm accustomed to calling it from the controller..
View
<a ng-controller="notifications">{{notifications.count}}</a>
Notifications controller
//Currently I call the request from the controller.. for brevity i just simplified.. i do have a service.js that organizes my request
UserService.GetNotifications()
.success(function (data) {
$scope.notifications.count = data.length;
}).error(function(error, status) {
//do something
});
};
Config
.run(function($http){
//i want to do the http request on interval
});