I using the following method to do some data polling. Here is my service
file to get $http
.service('employees', function ($http) { this.getEmployees = function() {
return $http.get( './data/employee.json' ); };
This is my controller
.controller('The3Ctrl', function ($scope, employees, $interval) { var _this =
this; $scope.getData = function() {
employees.getEmployees().then(function(response){ _this.items = response.data;
$scope.items = _this.items; }); } $scope.getData(); $interval(function(){
$scope.getData(); }, 10000);
With this the getData function is triggered every 10 seconds. However, What
I want is for the function to only be triggered if there is a change in
data (data.json) file. If there is no data change, it's useless for the
function to be triggered.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.