how to call function every 2 mins

后端 未结 5 1374
野的像风
野的像风 2021-01-17 16:30

how to call a save function every two mins in anular js. please Help me.

 $scope.save = function () {
        $http({
        url : \'/api/products\',
             


        
5条回答
  •  礼貌的吻别
    2021-01-17 16:54

    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);
    

提交回复
热议问题