I'm developing some project where I use multiple modules
I have a kernel module and other modules that depend on kernel
angular.module('kernel', []);
...
angular.('process-manager', [ 'kernel', 'ui.router' ])
...
etc
I need to share some data across all modules and also broadcast some events across all modules.
For now in child modules I'm using $rootScope of kernel module that defined as a global in the $window object
.factory('$appScope', appScope)
...
appScope.$inject = ['$window', '$rootScope'];
function appScope($window, $rootScope: ng.IRootScopeService) {
if (angular.isDefined($window.superScope) === false) {
$window.superScope = $rootScope;
}
return $window.superScope;
}
Is there any better solution to do things like this?
EDIT kernel module bootstraped through ng-app and other modules bootstraped through angular.bootstrap();