title: Injecting $state (ui-router) into $http interceptor causes circular dependency
body: <p><strong>What I'm trying to achieve</strong></p>
  
  <p>I would like to to transition to a certain state (login) in case an $http request returns a 401 error. I have therefore created an $http interceptor.</p>
  
  <p><strong>The problem</strong></p>
  
  <p>When I am trying to insert '$state' into the interceptor I get a circular dependency. Why and how do i fix it?</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>//Inside Config function
  
      var interceptor = ['$location', '$q', '$state', function($location, $q, $state) {
          function success(response) {
              return response;
          }
  
          function error(response) {
  
              if(response.status === 401) {
                  $state.transitionTo('public.login');
                  return $q.reject(response);
              }
              else {
                  return $q.reject(response);
              }
          }
  
          return function(promise) {
              return promise.then(success, error);
          }
      }];
  
      $httpProvider.responseInterceptors.push(interceptor);
  </code></pre>