I need to do a broadcast when the page loads. The problem is that the controller never catches the broadcast (my guess is that this is because it hasn't been properly loaded). I have done some research on how to wait for the controllers to be loaded and I've found that I can get a list with all loaded controllers with something like this:
searchApp.controller()._invokeQueue
$injector
broadcast
directives
_invokeQueue
Set a variable on the $rootScope
and then show/hide your overlay based on that variable. I would suggest that your controller and/or ng-view
not be defined on the body
tag but rather in a child element that way you can define your overlay outside of that "view".
Here a plunkr showing how it works.