title: AngularJS modify $scope inside interceptor
body: <p>How can i modify a <code>$scope</code> variable inside an interceptor?</p>
  
  <pre><code>var portal = angular.module('portal', ['ngResource', 'ui.utils', 'ngRoute']).config(function($httpProvider) {
      $httpProvider.interceptors.push(function($q) {
          return {
              responseError: function(rejection) {
                  if(rejection.status == -1) {
                      // i want to modify this variable to true / false
                      $scope.restApiServerOnline = false;
                      return;
                  }
                  return $q.reject(rejection);
              }
          };
      });
  });
  </code></pre>
  
  <p>The purpose of the above code is to intercept all HTTP post / get made to the REST server, and if it fails, toggle this scope variable.</p>