title: How to deal with $interval is not a function error in angularjs?
body: <p>I am using angularjs $interval function to increase/decrease a value continuously when I click on up/down arrows. But I am getting an error "TypeError: $interval is not a function" when I try to increase/decrease. How to solve this problem, thanks in advance. This is the code I have written so far:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$scope.onMouseDown = function (type) {
    promise = $interval(function () {
      if (type == 'Inc') {
         $scope.increaseVal();
      }
      else if (type == 'Dec') {
         $scope.decreaseVal();
      }
    }, 150);
  };
  $scope.stopInterval = function () {
     $interval.cancel(promise);
  };</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div&gt;&lt;a href="javascript:;" class="arrow" data-spin="up"&gt;&lt;i class="fa fa-caret-up" ng-mousedown="onMouseDown('Inc')" ng-mouseup="stopInterval()" ng-mouseleave="stopInterval()" ng-click="increaseVal()"&gt;&lt;/i&gt;&lt;/a&gt;
  &lt;a href="javascript:;" class="arrow" data-spin="down"&gt;&lt;i class="fa fa-caret-down" ng-mousedown="onMouseDown('Dec')"
  ng-mouseup="stopInterval()" ng-mouseleave="stopInterval()" ng-click="decreaseVal()"&gt;&lt;/i&gt;&lt;/a&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>