title: Injection versus global static class with Angular 2
body: <p>I'm creating a project where I need a "constants" class to contain some configuration values. Here is an extract of this class :</p>
  
  <pre><code>export class Constants
  {
      static Configuration = class
      {
          static CookieName:string = 'etl_language';
      };
  
      ...
  
      static View = class
      {
          static Militaries:string = 'militaries';
          static Mutants:string = 'mutants';
          static Objects:string = 'objects';
          static Scientists:string = 'scientists';
      };
  }
  </code></pre>
  
  <p>When I'm in a component with Angular 2, I can use that class by importing it :</p>
  
  <pre><code>import {Constants} from "../../misc/constants";
  </code></pre>
  
  <p>And then, just reference it :</p>
  
  <pre><code>this.cookieName = Constants.Configuration.CookieName;
  </code></pre>
  
  <p>It works pretty well but I have the feeling that I should use the dependency injection engine of Angular 2 to inject a reference to that class in the constructor but it seems a bit overkill. However, I have the feeling that I'm violating the "Angular way" of doing things, so I don't know if I can stick with my solution or if I have to use DI.</p>
  
  <p>Any advice ?</p>