Is there a way to list all of the directives and controllers that have been defined for a given angular module? For example, imagine I define three controllers in the 'main' module (i.e. angular.module('main').controller('MainCtrl',function() {...}). Is there are way to get the list of those three controllers?
AngularJS ng-controller Directive The ng-controller directive adds a controller to your application. In the controller you can write code, and make functions and variables, which will be parts of an object, available inside the current HTML element. In AngularJS this object is called a scope.
AngularJS directives are extended HTML attributes with the prefix ng- . The ng-app directive initializes an AngularJS application. The ng-init directive initializes application data. The ng-model directive binds the value of HTML controls (input, select, textarea) to application data.
In AngularJS, $scope is the application object (the owner of application variables and functions). The controller creates two properties (variables) in the scope (firstName and lastName). The ng-model directives bind the input fields to the controller properties (firstName and lastName).
There are two types of AngularJs directives: Built-in directive.
Hmm really hard and not a good thing i think but :
var app = angular.module('MyApp', []);
console.log(app._invokeQueue[0][2][1]);
_invokeQueue is an array if you do that for each entry getting the [0][2][1] you'll see the name of each provider in your module.
If you lok the _invokeQueue alone you'll see a lot of things that you'll like the name of the provider like below but his type too (directive, controller, ...);
But you feel that this is a tricky thing not a good thing a really bad practice but anyway really fun.
Don't use it in production !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With