title: Resolve data (from backend) into Root Component
body: <p>I have been struggling with this issue for quite some time now:</p>
  
  <p>I am trying to resolve data from the backend (re-validate user token from local storage) into the root component so I can set the HTTP headers accordingly.</p>
  
  <p>The resolve into "normal" components works just fine, I'm only struggling with the root component.</p>
  
  <p>main.ts</p>
  
  <pre class="lang-ts prettyprint-override"><code>platformBrowserDynamic().bootstrapModule(AppModule);
  </code></pre>
  
  <p>app.routes.ts</p>
  
  <pre class="lang-ts prettyprint-override"><code>export const AppRoutes: Routes = [{
      path: '',
      resolve: {
          token: LoginService
      },
      children: [
          ...HomeRoutes,
          ...LoginRoutes,
          ...DashboardRoutes
      ]
  }];
  </code></pre>
  
  <p>app.module.ts</p>
  
  <pre class="lang-ts prettyprint-override"><code>@NgModule({
      declarations: [
          AppComponent
      ],
      imports: [
          BrowserModule,
          FormsModule,
          HttpModule,
          RouterModule.forRoot(AppRoutes),
          MaterialModule.forRoot(),
          FlexLayoutModule.forRoot(),
          LoginModule,
          HomeModule,
          DashboardModule
      ],
      providers: [
          SessionService,
          LocalstorageService,
          HttpClient,
          LoginService
      ],
      bootstrap: [
          AppComponent
      ]
  })
  </code></pre>
  
  <p>app.component.ts</p>
  
  <pre class="lang-ts prettyprint-override"><code>@Component({
    selector: 'nos-app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.scss']
  })
  export class AppComponent implements OnInit {
      constructor(private _route: ActivatedRoute) {
          // this is undefined
          console.log(this._route.snapshot.data['token']);
      }
  }
  </code></pre>
  
  <p>dashboard.component.ts</p>
  
  <pre class="lang-ts prettyprint-override"><code>@Component({
    selector: 'nos-dashboard',
    templateUrl: './dashboard.component.html',
    styleUrls: ['./dashboard.scss']
  })
  export class DashboardComponent implements OnInit {
      constructor(private _route: ActivatedRoute) {
          // this is fine
          console.log(this._route.snapshot.data['token']);
      }
  }
  </code></pre>
  
  <p>Thanks alot for any advice!!!</p>
  
  <p>Regards
  Robin</p>