title: App_Initializer not working with UI-router
body: <p>UI-Router triggers route change as defined in config section before <code>App_Initializer</code> function is executed. In the below example home state's <code>resolveFn</code> is triggered before <code>App_Initialzer's</code> resolves.</p>
  
  <p>How to solve this?</p>
  
  <p><strong>app.module.ts</strong></p>
  
  <pre><code>@NgModule({
    declarations: [
      AppComponent,
      routingComponents
    ],
    imports: [
      BrowserModule,
      UIRouterModule.forRoot(
        { states: appRoutes, 
          useHash: true ,
          config: uiRouterConfigFn
        }
      ),
    ],
    providers: [
      {
          provide: APP_INITIALIZER,
          useFactory: test,
          multi: true
      }
    ],
    bootstrap: [AppComponent]
  })
  export class AppModule { }
  
  function test(): Function {
    return () =&gt; delay();
  }
  
  function delay(){
    var deferred = new Deferred&lt;any&gt;();
    console.log("Initialization started: " + new Date());
    setTimeout(() =&gt; {
      console.log("Initialization Done: " + new Date());
      deferred.resolve();
    }, 5000); // Wait 3s then resolve.
    return deferred.promise;
  }
  </code></pre>
  
  <p><strong>app.routes.ts</strong></p>
  
  <pre><code>export const routingComponents = [
      HomeComponent
    ];
  
  
  let home = {
      name: 'home',
      url: '/home',
      component: HomeComponent,
      resolve:[
        {
          token: 'te',
          resolveFn:($state: StateService) =&gt;{
            var deferred = new Deferred&lt;any&gt;();
            console.log("testing Home Component");
            deferred.resolve();
            return deferred.promise;
          }
        }
      ]
    }
  
    export const appRoutes = [
      home
    ];
  
    export function uiRouterConfigFn(router: UIRouter, injector: Injector) { 
      // If no URL matches, go to the `hello` state by default
      router.urlService.rules.otherwise({ state: 'home' });
    }
  </code></pre>