Skip to content

Instantly share code, notes, and snippets.

@dotproto
Last active February 14, 2024 01:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotproto/1343178be7bae2ac0320 to your computer and use it in GitHub Desktop.
Save dotproto/1343178be7bae2ac0320 to your computer and use it in GitHub Desktop.
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