How to make Angular SSR wait for async operations to finish that are initiated in ngOnInit?

32 views Asked by At

I have an Angular SPA similar to Instagram. I want to use Angular SSR and, for the sake of an example, let's look at profile pages.

In the HTML that the express server will return, I want to have things like bio, personal website, username, image, ... loaded. In other words: I need to make a request to my database, which is async.

  1. I guess that will delay the server responding time, right? Is that discouraged? Any way to improve this?

  2. On the other hand, I don't want to fetch the user's posts. That part should still be fetched on the client side. So I have some async operations that I want on the server side, and others on the client side. How can I make this distinction?

  3. How to make SSR wait for the async operation to finish that is initiated in ngOnInit? How can one implementat this?

0

There are 0 answers