I am developing a unique plugin for Angular that is designed to automatically initialize an Angular app module if none are found. However, if there is already a running or declared ng-app, my plugin will utilize that existing module instead. Here is an idea of what the code might look like:
// Retrieve list of active apps, whether from ng-app or manual bootstrap
activeAppModules = angular.getActiveApps();
if( !isEmpty(activeAppModules) )
{
var app = activeAppModules[0];
// Implement functionality for utilizing the already initialized app, such as controller registration or directive addition
}
else
{
// Manually bootstrap new apps
}