title: Injection using an InjectionToken?
body: <p>Attempting to inject an object using an <code>InjectionToken</code>.</p>
  
  <p>In the <code>AppModule</code> I have:</p>
  
  <pre><code>    export const tokenConfigKey = new InjectionToken('config');
  
      const tokenBasedConfig = {
          provide: tokenConfigKey,
          useValue: {
            key: 'value'
        }
      }
  </code></pre>
  
  <p>And in the <code>AppComponent</code>:</p>
  
  <pre><code>    @Component({
        selector: 'my-app',
        template:`&lt;h1&gt;Hello Angular Lovers!&lt;/h1&gt;`
      })
      export class AppComponent  {
        constructor(@Inject('config') config,
                    @Inject(tokenConfigKey) configByToken) {
        }
      }
  </code></pre>
  
  <p><a href="https://stackblitz.com/edit/angular-configuration-injection?file=src%2Fapp%2Fapp.module.ts" rel="nofollow noreferrer">This is a complete stacblitz example</a></p>
  
  <p>Injection using the string key is passing, but injection with the token is failing.  Any ideas why?</p>
  
  <h2>Article</h2>
  
  <p><a href="https://medium.com/@ole.ersoy/design-time-external-component-configuration-48dcbd314712" rel="nofollow noreferrer">Here's an article in case anyone wants to play with this</a></p>