title: How To Get Constant Inside ui-router (Angular) state function
body: <p>I want to reference a "constant" that is defined outside this state function but if I try to pass it in as a provider it errors  because constants are not providers.  That is, I want to do something like:</p>
  
  <pre><code>var exports = module.exports = function ($stateProvider,configData) { ...
  </code></pre>
  
  <p>But that fails.  How can I get my javascript variable baseDirectory passed in.  </p>
  
  <p>The bigger problem is that the webroot is not always at the same url. sometimes it is /ng and sometimes it is just / and I want to be able to set that as a config someplace I can load into a config file (not hard code into the state function.</p>
  
  <pre><code>var exports = module.exports = function ($stateProvider) {
    $stateProvider.state('home', {
      url: baseDirectory + '/home',
      templateUrl: '/templates/home/home.html',
      controller: 'HomeController',
    });
  };
  exports.$inject = ['$stateProvider'];
  </code></pre>