skip to Main 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)?

2

Answers


  1. Chosen as BEST 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.


  2. Idea is simple. All initialization, include data loading, doing on server side, when nodejs executes Angular application. And client will get html with initialized data. For any URL which crawler can request from server, angular app will be initialized, routed and then, based on app state rendered html and returned to client.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search