<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <title>$interval angularjs</title>
  <script src="https://code.angularjs.org/1.3.15/angular.js"></script>
  <script>
    var app = angular.module("IntervalApp", []);

     // $timeout service should be injected into a controller function.
    app.controller("IntervalCtrl", function($scope, $interval) {

      //Initialize the counter.
      $scope.count = 0;

      $scope.schedulingForTimeout = function() {
        $scope.count += 1;
      };

      // the $interval call every 1 second itself.
      $interval(function() {
        $scope.schedulingForTimeout();
      }, 1000);

    });
  </script>
</head>

<body ng-app="IntervalApp" ng-controller="IntervalCtrl">
  <div>$interval vs. $timeout angularjs</div>
  The counter : {{count}}
</body>

</html>
// Code goes here

/* Styles go here */