ng-app="SomethingApp"
- this what I have in the body of the master page.
Now different pages have different controllers. It might be 1 or more on the page.
Now, on the master page, I need to do the frequent changes within the controllers once their content is loaded.
I used this code
var someFunction = function () {
var injector = angular.element(document.querySelector('[SomethingApp]')).injector();
var someService = injector.get('someService');
var $rootScope = injector.get('$rootScope');
someService.someAjaxFunction(someAreaKey, true).then(function (someItems) {
for (i = 0, len = someItems.length; i < len; i++) {
var someItem = someItems[i];
var elem = angular.element(document.querySelector("'#" + someItem.Key + "'"))[0];
elem.innerText = someItem.Value;
}
}, function (data) {
$rootScope.Raw = data.status;
});
$rootScope.$digest();
}
angular.element(document).ready(function () {
someFunction();
});
Everything is working except one thing. When a document is ready, it doesn't mean the controllers are loaded. So, elements I am looking for to do the changes doesn't exist yet.
How can I identify when all the controllers are loaded?