title: Angular 4 Injecting route in the APP_INITIALIZER
body: <p>I am trying to retrieve a data present in the url in my APP_INITIALIZER</p>
  
  <p>app.module.ts</p>
  
  <pre><code>export function init(config: ConfigService, router: Router) {
      return () =&gt; config.load(router);
  }
  
  
  providers : [
      ...
      {
        provide: APP_INITIALIZER,
        useFactory: init,
        deps: [ConfigService, Router],
        multi: true
      },
      ConfigService 
      ... 
  ]
  </code></pre>
  
  <p>config-service.ts</p>
  
  <pre><code>@Injectable()
  export class ConfigService 
      load(router: Router): Promise&lt;any&gt; {
          console.log('current url : ' + router.url);
          return new Promise(((resolve, reject) =&gt; resolve()));
      }
  }
  </code></pre>
  
  <p>Unfortunately I am getting </p>
  
  <pre><code>Cannot instantiate cyclic dependency! ApplicationRef ("[ERROR -&gt;]"): in NgModule AppBrowserModule in ./AppBrowserModule@-1:-1
  </code></pre>
  
  <p>I also tried using the <code>Injector</code> in the constructor but it didn't work either.</p>
  
  <p>Is what I am trying to do even feasible ? </p>