Last active
November 13, 2019 06:33
-
-
Save dhoko/601aae43bc23218f4aa422dd04394102 to your computer and use it in GitHub Desktop.
AngularJs - get list of all registered directives
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
const listDirectivesApp = () => { | |
const listDirectives = name => { | |
return angular | |
.module(name) | |
._invokeQueue | |
.filter(item => 'directive' === item[1]) | |
.map(item => item[2][0]); | |
}; | |
return angular | |
.modules | |
.map(listDirectives) | |
.reduce((acc, l) => acc.concat(l), []); | |
}; |
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
/* | |
Inside vendor.js | |
source: http://stackoverflow.com/questions/24889783/angularjs-get-list-of-all-registered-modules | |
*/ | |
(function(orig) { | |
angular.modules = []; | |
angular.module = function() { | |
if (arguments.length > 1) { | |
angular.modules.push(arguments[0]); | |
} | |
return orig.apply(null, arguments); | |
} | |
})(angular.module); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment