In your controller, if you enter $window , you can search for dependencies, in particular .requires exists on your module. To do this, you can declare module as a global var so that we can find it on our $window , in this case, call it app - or - you can bypass the global variables and $window and call angular.module('myModule').requires directly.
- I added
ngRoute to prove an array of dependencies that will be discoverable.
var app = angular.module('myModule', [ 'ui.bootstrap', 'ngRoute' ]).controller('ctrl', ['$scope', '$window', function($scope, $window) { console.log($window.app.requires) // ["ui.bootstrap", "ngRoute"] console.log(angular.module('myModule').requires) // without global - $window not needed }]);
JSFiddle Link - working example
Note. If you use global variables, you can simply call window as such: window.app.requires - without entering $window . However, see AngularJS $ window docs to see why $window is preferred.
scniro
source share