I have an angular2 RC6 application and I need to defer loading pages until after some functionality is executed.
I have a service that determines the URI for the webApi. I need the application to wait until this URL is determined before it tries to load any data. If I hide the main application in app.component, with an *ngIf, I get routing errors because the router outlet does not exists.
Before RC5/6 I manually bootstrapped the application after the service get's the URI.
If you use the router you can use canActivate, canActivateChild.
See also
For loading once before app initialization you can use APP_INITIALIZER as explained in How to pass parameters rendered from backend to angular2 bootstrap method
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With