how to call a save function every two mins in anular js. please Help me.
$scope.save = function () {
$http({
url : \'/api/products\',
You could try using the $interval service.
In case you need something more accurate, consider using an external library.
You can try the following way also.
Declaring the interval:
var interval = null;
To cancel interval:
if (interval != null)
$interval.cancel(interval);
Call the function as per as interval:
$interval(function() {
$scope.function();
}, 120000);
you can use setInteraval function to call your function every 120000 milliseconds.
setInterval(function(){
$scope.save();
}, 120000)
You can use $interval from angularjs
setInterval(function(){
$scope.save();
}, 120000)
you can use setInteraval function.
setInterval(function(){
$scope.save();
}, 120000)