At the start of my application(after login, each reload), i would like to load(API-request) a logo in the background which im going to need later on. Is there a way to let it load in the background without it affecting the performance?
I tried to execute the request inside the app.component.ts because thats the one class which gets executed right at the start:
export class AppComponent {
constructor(private oAuthService: OAuthService, private logoService: LogoService) {
// a lot of configs...
this.oAuthService.configure(config);
this.oAuthService.setStorage(sessionStorage);
this.oAuthService.tryLogin({}).then();
this.logoService.getLogo().subscribe(logo => {
// save logo somewhere
}
}
}
But this ended up slowing down the first loading process. Why is that? Isnt the request just happening asynchronously in the background?