title: Angular app.module.ts APP_INITIALIZER in providers section, a StaticInjectorError(AppModule)[InjectionToken Application Initializer
body: <p>I am trying to load initial configuration on file to load the following in app.module.ts</p>
  
  <pre><code>let myConfig = undefined;
  export function initializeMyApp(nmyService : MyConfigService ) {
    return (): Promise&lt;any&gt; =&gt; nmyService.loadConfig()
        .toPromise()
        .then( config =&gt; {
          myConfig = config;
        })
  }
  
  imports: [MsalModule.forRoot({ clientID = myConfig.clientID etc... })
  
  providers: [
      {
        provide: APP_INITIALIZER,
        useFactory: initializeMyApp,
        deps: [MyConfigService],
        multi: true
      },
  ]
  </code></pre>
  
  <p>When I startup the app, I get the following error</p>
  
  <pre><code>&gt; Error: StaticInjectorError(AppModule)[InjectionToken Application
  &gt; Initializer -&gt; MyConfigService]:  main.ts:12 Failed to load resource:
  &gt; the server responded with a status of 404 (Not Found)
  &gt; [https://localhost:4200/site.json] Manifest: Line: 1, column: 1,
  &gt; Unexpected token. [https://localhost:4200/site.json]
  </code></pre>
  
  <p>Any idea? Thanks.</p>