Is there a way to know what dependencies were injected into my Angular module?
angular.module('myModule', [
'ui.bootstrap'
])
.controller('myController', [function () {
// var dependencies = Magic.dependencies;
// console.log(dependencies);
}]);
In your controller, if you inject
$window, you can dig for the dependencies, specifically, there exists a.requireson your module. To do this, you can either declare your module as a globalvarso we can find it on our$window, in this case, let's call itapp- or - you can bypass globals and$windowand callangular.module('myModule').requiresdirectly.ngRouteas well to prove the array of dependencies that will be discoverable.JSFiddle Link - working example
Note - If leveraging globals, you can simply call the
windowas such:window.app.requires- without injecting$window. However, see the AngularJS $window docs to understand why$windowis preferred.