title: Inject Angular Constants in TypeScript
body: <p>I have converted my first angular factory to TypeScript in my project. I'm now trying to bring in the constants from a new typescript file.</p>
  
  <p>Here is the typescript file that will eventually hold more than one constant value </p>
  
  <pre><code>module app.config {
       export class Constants {
           static get Default(): any {
               return {
                   apiServer: 'http://localhost/MyApplication'
               }
           }
  
       }
  
       angular
           .module('app');
   }
  </code></pre>
  
  <p>Here is the new TypeScript file where I'm trying to pull in the value of <code>apiServer</code> that used to be in a <code>constants.config.js</code> file</p>
  
  <pre><code>module app.services {
      interface IStoreFactory {
          apiServer: string;
      }
  
      var constant = new app.config.Constants.Default();
  
      export class StoreFactory implements IStoreFactory {
  
          static $inject = ['$http', '$log']
          constructor(private $http, $log) {
          }
  
          apiServer = constant.apiServer;
  
          getRegisters() {
              return this.$http.get(this.apiServer + 'stores/1/registers');
          }
      }
  
      angular
          .module('app.services')
          .service('storeFactory', StoreFactory);
   }
  </code></pre>
  
  <p>When I hard coded the value of <code>apiServer</code> in this service it worked fine. I'm getting the error that it:</p>
  
  <blockquote>
    <p>cannot read property of 'Constants' of undefined.</p>
  </blockquote>
  
  <p>What do I need to do to the <code>app.config</code> file to make it accessible in the <code>app.services</code> file?</p>
  
  <p><em>Side note: Also it seems odd that there is a blank <code>controller</code> I'm sure that isn't being used correctly.</em></p>