Show which policies are being used on the page

1

Is there any way to find out which policies are being used on a page?

Below is an example

<div>
algumas coisas ...
<minhadiretiva></minhadiretiva>
<minhadiretiva1></minhadiretiva1>
<minhadiretiva2></minhadiretiva2>
outras coisas ...
</div>

And here is the html for the "minadirector"

<div>
<minhadiretivafilha></minhadiretivafilha>
<minhadiretivafilha1></minhadiretivafilha1>
<minhadiretivafilha2></minhadiretivafilha2>
</div>

Question 1: How can I display the list of policies that were used on this page? (for example on the console or somewhere else)

The answer to this question should be

minhadiretiva, minhadiretivafilha, minhadiretivafilha1, minhadiretivafilha2, minhadiretiva1, minhadiretiva2

Question 2: If there is an answer to question 1, is there a way to "discover" the policies used using only the browser console? Or do I need my directives to follow some sort of pattern? (eg some attribute or something)

NOTE: I asked the same question on the gringo stackoverflow, but I did not get much interest from the community in answering this question. The idea is to bring this doubt here and see if our community is more interested in answering it.

    
asked by anonymous 03.10.2016 / 12:51

1 answer

1

There are two options (which I know):

  • Add console.log manually;
  • AngularJs Batarang - Extension for chrome;

With the use of the console, it is very simple and straightforward, just add one at the beginning of each directive and write some identification for it. For example:

app.directive('minhaDiretiva', function() {
    console.log('minhaDiretiva');
});

The problem with this is that it is done manually, so it can be 'laborious'.

The other method is to use the AngularJs Batarang , an extension to the chrome that serves as an analysis tool for your application. It shows all the structural scope of your application, number of watchers, functions, the time each thing is taking of your application, etc. It is an analysis tool for you to better analyze your project.

It will not be so simple to identify the policies if you have a very complex project, with multiple policies used together, and so on ... But it is an EXCELLENT tool and you can certainly make a great debug project.

    
03.10.2016 / 12:59