0

We need to ensure in Angular 4 application that on bootstrap of AppModule (root module) there will be information about loggedin user already available. How to achieve it?

I was trying to implement this solution:

How to call an rest api while bootstrapping angular 2 app

but the problem is - application just send a request while bootstraping. I need to have data on initialization, that's why I'd like to start bootstraping on promise success.

I also tried this one:

How to bootstrap an Angular 2 application asynchronously

But it seems out-of-date.

Injector.resolveAndCreate() method not exists in Angular 4 version and HTTP_PROVIDERS cannot be imported. Any other ideas / solutions?

magos
  • 3,371
  • 4
  • 29
  • 54
  • You can use the [Resolve Guard](https://angular.io/guide/router#resolve-pre-fetching-component-data) for your root component – Nehal Aug 02 '17 at 13:55
  • What do you mean? What way? – magos Aug 02 '17 at 13:58
  • I'm asking what way, because I don't have a routing to AppComponent, where I'd like to have that data (before any route is activated). – magos Aug 02 '17 at 14:02

0 Answers0