I am new to angular and trying out different things. Recently I stumbled upon an issue that needs me to take some actions based on the results being returned by the k but before anything loads in the application.
Right now I am calling a webapi in the kof the app.component.ts, and based on that I am hiding the contents in the website but recently I noticed a slow response from the server that caused a slow response from the webapi hence the actions that needed to be taken are delayed hence not hiding the content.
Now, instead of the of the app.component where I am calling the api which returns promise and then inject the result into the css of the body's kI need to put the api call somewhere until the result is returned the system should not proceed.
update:
ngOninit() of the app.component, we have called an api that basically returns the true/false. Based on that, 'type' a class is injected into the document.body i.e. IsVisible. And in the Sass of app.component it disables the logos and other contents in the web page.
api call
const res= app.services.getIsActiveType().toPromise();
document.body.ClassList.Add(res.type);
in sass
body {
&.Type{
logos {
dispaly: none;
}
}
}