title: how to invoke event based on angular $timeout?
body: <p>I have live logs coming so to pause/resume live streaming i added button on screen, if user pause live logs resume it after 120 secs , So in normal it works good if user pause logs it will resume in 120 sec but if user resume before 120 secs by clicking on resume button then after 120 sec it will pause logs again wihtout user interaction with button. Any idea where i implemented wrong code ?</p>
  
  <p>main.html</p>
  
  <pre><code>&lt;span class="serverConnectInfo" ng-if="enableLiveRecording === true"&gt;
    &lt;button type="button" class="btn btn-primary btn-md"  ng-click="stopLiveEvent()"&gt;&lt;span class="glyphicon glyphicon-pause"&gt;&lt;/span&gt;pause&lt;/button&gt;
  &lt;/span&gt;
  &lt;span class="serverConnectInfo" ng-if="enableLiveRecording === false"&gt;
     &lt;button type="button" class="btn btn-primary btn-md"  ng-click="stopLiveEvent()"&gt;&lt;span class="glyphicon glyphicon-play"&gt;&lt;/span&gt;resume (in {{counter}}s)&lt;/button&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>ctrl.js</p>
  
  <pre><code>function resetTimer(){
          $scope.counter = 120;
      }
      // resetTimer();
  
      $scope.onTimeout = function(){
          $scope.counter--;
          if($scope.counter &gt; 0){
              var  mytimeout = $timeout($scope.onTimeout,1000);
          }
          if($scope.counter === 0){
              $scope.stopLiveEvent();
              resetTimer();
          }
      }
  
      $scope.stopLiveEvent = function(){
          $scope.enableLiveRecording = !$scope.enableLiveRecording;
          if($scope.enableLiveRecording === false){
              resetTimer();
              toastr.warning('stop showing live event!');
              $scope.onTimeout();
          }
          if($scope.enableLiveRecording === true){
              toastr.info('start showing live event!');
              (function () {
                  $scope.event = $scope.event.concat(tempStoreEvent);
                  tempStoreEvent = [];
              })();
          }
      }
  </code></pre>