title: How to access $window in a Provider?
body: <p>I'd like to access <code>$window</code> from a provider (<code>mymodule.provider(...)</code>) <strong>BUT</strong> I need such dependency at config time (so it's no use for me to put such dependency in the <code>$get</code>).</p>
  
  <p>Currently I don't access <code>$window</code>, and the reason I need such dependency in config time is because I need to access <code>$window.STATIC_URL</code>, which is a constant in the window, and I use it to configure the states' templates (<code>$stateProvider</code>).</p>
  
  <p>Current code is:</p>
  
  <pre><code>mymodule.provider('StaticUrl', function() {
      this.url = function() { return window.STATIC_URL || 'static'; };
      this.$get = this.url;
  });
  </code></pre>
  
  <p>This is because I need such value in both config and run time (I use it for more than just setting up the states, so when I need such url in a controller, I import it as a dependency).</p>
  
  <pre><code>//config
  mymodule.config(['StaticUrlProvider', '$stateProvider', function(sup, $sp){
      //...
      $sp.state('main', {
          templateUrl: sup.url() + 'path/to/template.html'
      });
      //...
  }]);
  //run-time (in this case: a controller)
  mymodule.controller('MyController', ['$scope', 'StaticUrl', function($s, su) {
      var buildingType = /*a complex expression here*/;
      $s.buildingPicture = $su + 'path/to/building/pics/' + buildingType + '.png';
  }]);
  </code></pre>
  
  <p>Given an existing dataset, I have a picture for each entry, located under STATIC_URL, which must be provided. So this means I use such constant in both stages.</p>
  
  <p>How would I do it in a more Angular-way (<strong>i.e. without relying in globals</strong>)? Is there a way I can access <code>$window</code> from a provider without raising a <code>moduleerr</code>?</p>