title: Angular, show loading when any resource is in pending
body: <p>I already write a code to display a loader div, when any resources is in pending, no matter it's getting via $http.get or routing \ ng-view.
  I wan't only information if i'm going bad...</p>
  
  <p>flowHandler service:</p>
  
  <pre><code>app.service('flowHandler', function(){
      var count = 0;
      this.init = function() { count++ };
      this.end = function() { count-- };
      this.take = function() { return count };
  });
  </code></pre>
  
  <p>The MainCTRL append into <code>&lt;body ng-controller="MainCTRL"&gt;</code></p>
  
  <pre><code>app.controller("MainCTRL", function($scope, flowHandler){
      var _this = this;
      $scope.pageTitle = "MainCTRL";
      $scope.menu = [];
      $scope.loader = flowHandler.take();
  
      $scope.$on("$routeChangeStart", function (event, next, current) {
          flowHandler.init();
      });
  
      $scope.$on("$routeChangeSuccess", function (event, next, current) {
          flowHandler.end();
      });
  
      updateLoader = function () {
          $scope.$apply(function(){
              $scope.loader = flowHandler.take();
          });
  
      };
  
      setInterval(updateLoader, 100);
  
  });
  </code></pre>
  
  <p>And some test controller when getting a data via $http.get:</p>
  
  <pre><code>app.controller("BodyCTRL", function($scope, $routeParams, $http, flowHandler){
      var _this = this;
      $scope.test = "git";
  
      flowHandler.init();
      $http.get('api/menu.php').then(function(data) {
          flowHandler.end();
          $scope.$parent.menu = data.data;
  
      },function(error){flowHandler.end();});
  });
  </code></pre>
  
  <p>now, I already inject flowHandler service to any controller, and init or end a flow.</p>
  
  <p>It's good idea or its so freak bad ?</p>
  
  <p>Any advice ? How you do it ?</p>