Ad

Angular2 Serverside Rendering: Dynamic Content

I often read about serverside rendering as a great new feature of Angular2 which shall make webapps crawleable by Google, Bing, etc. .

But how does this work for content that is loaded dynamically when the app starts? Will the crawler wait for those pending requests before indexing the page? Or do I have to specify a certain state of my Angular2 app, which tells the server that my app is ready to get sent to the client (which is the crawler in this case)?

Ad

Answer

I finally found the solution in a comment inside the getting started code:

[...]

// if true, server will wait for all async to resolve before returning response
async: true,

[...]

When setting this flag to true, the server will wait for all async calls (like http calls) before returning the rendered website.

Ad
source: stackoverflow.com
Ad