Last active
February 14, 2024 01:54
-
-
Save dotproto/1343178be7bae2ac0320 to your computer and use it in GitHub Desktop.
Retrieve a list of custom for your Angular module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | | | |
-------------------------------------------------------------- | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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