title: Angularjs $interval returns fn is not a function
body: <p>I want to check if cookie exists with $interval. I am calling $interval on page load. This call periodically throws an error:</p>
  
  <pre><code>&gt; TypeError: fn is not a function
  &gt;     at callback (angular.js:12516)
  &gt;     at Scope.$eval (angular.js:17444)
  &gt;     at Scope.$digest (angular.js:17257)
  &gt;     at Scope.$apply (angular.js:17552)
  &gt;     at tick (angular.js:12506)
  </code></pre>
  
  <p>I really don't understand why.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>angular.module("appModule")
  .controller("loginController", ["$scope", "$http", "$window", "$document", "$interval", "$cookies",
      function ($scope, $http, $window, $document, $interval, $cookies) {
  
      var stopInterval;
      $scope.CheckLoginCookie = function () {
  
          if ($cookies.get("Login") != null) {
  
              if (angular.isDefined(stopInterval)) {
                  $interval.cancel(stopInterval);
                  stopInterval = undefined;
              }
  
              $window.location.href = $scope.UrlNotes;
          }
      }
  
      $scope.Repeat = function ()
      {
          stopInterval = $interval($scope.CheckLoginCookie(), 1000);
      }
  }]);
  </code></pre>
  
  <p>Code is being called from $document.ready:</p>
  
  <pre><code>$document.ready(function () {      
      $scope.Repeat();
  })
  </code></pre>