title: Getting an error of "this.appInits[i] is not a function" when putting in an APP_INITIALIZER in my angular app
body: <p>I'm trying to implement <a href="https://www.npmjs.com/package/keycloak-angular" rel="nofollow noreferrer">https://www.npmjs.com/package/keycloak-angular</a> into my site, so that my front-end angular app can authenticate a user with Keycloak.</p>
  <p>After putting in the code, I keep getting an error of:</p>
  <pre><code>ERROR TypeError: this.appInits[i] is not a function
      at ApplicationInitStatus.runInitializers (core.es5.js?de3d:2807)
      at eval (core.es5.js?de3d:4506)
  </code></pre>
  <p>Anyone know why this might be happening? I am using Angular 4.3.2 and keycloak-angular 7.2.0 and keycloak-js 8.0.2.</p>
  <p>Here is most of my app.module.ts:</p>
  <pre><code>import {NgModule, APP_INITIALIZER} from '@angular/core';
  import { KeycloakService, KeycloakAngularModule } from 'keycloak-angular';
  import { initializer } from './utils/app-init';
  ...
  
  @NgModule({
      imports: [
          ...
          KeycloakAngularModule
      ],
      declarations: [
          ...
      ],
      providers: [
          ...
          {
              provide: APP_INITIALIZER,
              useFactory: initializer,
              multi: true,
              deps: [KeycloakService],
  
              useClass: OdpToastOptions
          }
      ],
      bootstrap: [JhiMainComponent]
  })
  
  export class UiAppModule {}
  
  </code></pre>
  <p>Here is my app-init.ts:</p>
  <pre><code>export function initializer(keycloak: KeycloakService): () =&gt; Promise&lt;any&gt; {
  
      keycloak.init({
          config: {
              url: 'https://keycloak.mydomain.com/auth',
              realm: 'myrealm',
              clientId: 'myclient',
          },
          initOptions: {
              onLoad: 'login-required',
              checkLoginIframe: false,
          },
          enableBearerInterceptor: true,
          bearerExcludedUrls: ['/assets', '/clients/public'],
      });
  
      return (): Promise&lt;any&gt; =&gt; keycloak.init();
  }
  </code></pre>