Skip to content

Instantly share code, notes, and snippets.

@dotproto
Last active Aug 29, 2015
Embed
What would you like to do?
Retrieve a list of custom for your Angular module
var deps = require('./getModuleDeps');
console.table(deps('myModule'));
/* Example output (ASCII-fied)
--------------------------------------------------------------
| (index) | provider | type | name |
|---------|--------------------|-------------|---------------|
| 0 | "$compileProvider" | "directive" | "myDirective" |
| 1 | "$provide" | "service" | "myService" |
| 2 | "$provide" | "factory" | "myFactory" |
| 3 | "$injector" | "invoke" | |
--------------------------------------------------------------
*/
function getModuleDeps(name) {
return angular.module(name)._invokeQueue.map(function(item) {
return {
provider: item[0],
type: item[1],
name: item[2][0],
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment