I need to fetch the route data before application bootstraps in angular.
Something like we do in AngularJS[https://stackoverflow.com/a/16539428/6687096]
In the above link we can make normal ajax call to fetch the data from server then application will bootstrap manually.
How can we implement same mechanism in angular?
OR Is there any pre-built event to fetch the data from the server before application bootstrap. ?
OR We have to make http
call from main.ts
file ? If we do so how can we share the response with other components ?
Eg:
if (environment.production) {
enableProdMode();
}
someHttpCall().then(function(response){
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
})
If we do something like above how to create HttpClient
instance as there is NO class ?