title: AngularJS: how to use $http in config phase
body: <p>I am building a single page application using angular. We use Continuous Integration with several <em>Dev</em> and <em>QA</em> environments. This means that every time I deploy the app in a different environment I need to update some config parameters such as SPA baseUrl, rest api url or url for my oauth server.</p>
  
  <p>To achieve this, our CI engine generates a config.json file with the correct parameters for each environment when we are about to deploy there. To get this I have created a really simple service:</p>
  
  <pre><code>(function () {
    'use strict';
  
    angular
      .module('app.core')
      .factory('config', config);
  
    config.$inject = ['$http'];
  
    function config($http) {
      return {
        load: load
      };
  
      //////////
  
      function load() {
        return $http.get('assets/config/config.json');
      }
    }
  }());
  </code></pre>
  
  <p>Most of my services are configured through providers during the <em>config phase</em>. And here is where the problem comes up. As you know, services cannot be injected during this phase but I would like to use <em>config</em> service to set up my providers with the correct URLs and parameters.</p>
  
  <p>Is there a proper way to do this? </p>
  
  <p>The only thing I can consider so far is having these config parameters embed in my module creation file so they are there ready to use. It seems quite ugly since I don´t want any external process to my app modifying my source code. </p>