Как установить и Intveral в Angularjs? Я хочу получить через каждые 5 секунд данные.Угловой js setInterval
Мой код:
myApp.service('dataService', function ($http) {
this.getData = function() { //want to call this function after every 5 sec.
$http({
method: 'GET',
url: "http://localhost:8080/api/FaceReaderData"
}).success(function (data) {
console.log(data)
});
}
});
myApp.controller('MainController', function ($scope, dataService) {
$scope.data = null;
dataService.getData(function (dataResponse) {
$scope.data = dataResponse;
});
});
ТНХ заранее