title: AngularJS Service InterDependency to pass auth token to Http Header
body: <p>I have created three services, OpenApi, SecureApi, and TokenHandler. I want to use TokenHandler Service from SecureApi Service. When authentication will happen controller code will set token in TokenHandler.Set() method. and I want SecureApi to cal tokenHandler.get() as below. Is it Possible. Right now I am getting below error:-</p>
  
  <p>EDIT:- fixed below error (updated the code below too, but my token is still not getting through as part of header :()</p>
  
  <p>Unknown provider: tokenHandlerProvider &lt;- tokenHandler &lt;- SecureApi </p>
  
  <p>Code:-</p>
  
  <pre><code>/* Services */
  angular.module('MyApp.services', ['ngResource'])
      .factory('OpenApi', function ($resource) {
  
          var openApi = $resource(
              '/api/:controller/:id',
              [],
              {
                  postLogOn: { method: 'POST', params: { controller: 'Account' } },
                  postCustomer: { method: 'POST', params: { controller: 'Employee' } }
              }
          );
          return openApi;
      })
  
  .factory('TokenHandler', function () {
      var tokenHandler = {};
      var token = "none";
  
      tokenHandler.set = function (newToken) {
          token = newToken;
      };
  
      tokenHandler.get = function () {
          return token;
      };
      return tokenHandler;
  })
  
  
     .factory('SecureApi', ['$resource', 'TokenHandler', function(res, tokHandler) { 
         var secureApi = $resource(
          '/api/:controller/:id',
          [],
          {
      getInsightCustomer: { method: 'GET', params: { controller: 'MyCustomer' }, headers: {Authorization_Token: tokenHandler.get()} }
          }
      );
         return secureApi;
     }]);
  </code></pre>