title: How to clear or stop timeInterval in angularjs?
body: <p>I am making a demo in which I am fetching data from the server after regular intervals of time using <code>$interval</code> Now I need to stop/cancel this.</p>
  
  <p>How I can achieve this? If I need to restart the process, how should I do that?</p>
  
  <p>Secondly, I have one more question: I am fetching data from the server after reqular intervals of time. Is there any need to use <code>$scope.apply</code> or <code>$scope.watch</code>? </p>
  
  <p>Here is my plunker:</p>
  
  <pre><code>  app.controller('departureContrl',function($scope,test, $interval){
     setData();
  
     $interval(setData, 1000*30);
  
     function setData(){
        $scope.loading=true;
      test.stationDashBoard(function(data){
          console.log(data);
          $scope.data=data.data;
          $scope.loading=false;
          //alert(data);
      },function(error){
          alert('error')
      }) ;
  
     }
  });
  </code></pre>
  
  <p><a href="http://plnkr.co/edit/ly43m5?p=preview">http://plnkr.co/edit/ly43m5?p=preview</a></p>