0

We have a SPA running on angular and we need to generate an event whenever a page has completed rendering after all of its ajax calls.

Any ideas that will prevent us from doing it on each page ?

Gil.

gil
  • 65
  • 5

1 Answers1

0

Maybe create a service that will get signaled two times.

  1. when the 1st request begins and

  2. when the last response is collected (implemented via promises).

Then maybe you can broadcast a message that can be heard from the controllers, so they can start the rendering.

Well, not an expert here, so don't judge me too hard!

Victor Benetatos
  • 396
  • 3
  • 12
  • Hi victor,Thanks. But can u think of an automatic help to identify the last response? – gil Apr 04 '16 at 11:59
  • Well you can use $q as shown here : Or you can enumerate them in a way, depending from there come from. If the requests if from path A, then i expect 3 request/responses etc. – Victor Benetatos Apr 04 '16 at 12:04