How can I retrive the name of the current app in AngularJS?
I mean the ng-app=\"foo\"
value.
I have searched through the API documentation, but I could
From the $rootElement docs:
The root element of Angular application. This is either the element where ngApp was declared or the element passed into angular.bootstrap.
If you inject it you can get the main module name without scanning the DOM:
...
app.controller('MyCtrl',
[
'$scope',
'$rootElement',
function($scope, $rootElement) {
console.log($rootElement.attr('ng-app')); // --> myApp
}
]
);