Answer the question
In order to leave comments, you need to log in
How to load an Angular component only after making a request to the server?
I have a component. When it is called, a get request occurs (for example, from a constructor or ngOnInit). It turns out that while we are waiting for the results of this request (executing code from subscribe), our component is already displayed on the user's page. How can I make the component not render until the request ends and the result of the request has been processed?
Answer the question
In order to leave comments, you need to log in
<app-component *ngIf="show"></app-component>
public show: boolean;
this.doRequest().subscribe(() => this.show = true));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question