Click here to Skip to main content
15,901,284 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I have a situation where many of my controls have their own controller functions, even the masterCtrl (on the master page)

So I need to display my splash until each and every controller has finished loading data via async promises.

I could quite easily pass all promises up to the masterCtrl which could execute all and close the splash on completion.

My issue is how do I know when to execute the array of promises? How does masterCtrl (which will always be the parent of the sub controllers) know that it has all the promises?

Oh, and all controllers hang of the same masterApp module.

What I have tried:

I currently wait for the page to load:

JavaScript
angular.element(document).ready(function () {
    promise.all($scope.promised).then(()=>$scope.splash.close())
})


but I don't know if this triggers only after the controllers are ready, or if it's just late enough that the controllers have loaded in the mean time anyway and I might as well have a second timeout instead. I am clueless as to how these events tie together
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900