Difference between the directives and static DOM elements in AngularJS

I have already read the Compilation process, and directive matching on AngularJS Doc.

but I really didn't understand the directives.

Example:

I have static html:

<div class="test test2" cid="549" sid="a5e3c4f8a9">text-text-text</div>

when I do it manually, I know it will only created and called one time at browser's parse time.

but what happens when I create a directive with the same dom element ?

<x my-directive>text-text-text</x>

is this the same effect?

I am asking such a newbie question, because I am using over 200 elements on my html page. If I change them to single directive: for sure it will be much more easier to manage them.

and its no problem if its only slow at browser's compile time but what happend in run time?

and I am sorry, if the qustion is not pro enought. I am just new to Stackoverflow.

Thank You

Daniel

If I understand you correctly, you want to know how AngularJS creates a directive and how many times your directive methods are called.

When you create a directive (with module.directive('myDirective', ...)), you are really just creating a definition. Every time you use that directive (like <div my-directive>), AngularJS will run through the process described in the guide: that is, it will compile and link each use. It has to be this way because the directive doesn't exist in isolation; it exists not only in the $scope in which it was called, but also it can make use of element attributes and transcluded contents. The definition occurs once, but each instance is compiled and linked.

Once the directive is created, it's technically done; if you don't set up any $watch or $observe or event bindings, your "directive" is now just whatever's in the DOM at the end of your link function - there's no more computation. In other words, what happens after compilation and linking is entirely up to you.

So back to your example: if you use 200 of the same directive on the page, the directive will be defined once, but all 200 will be compiled and linked separately. But I'm not really sure what you're implying by asking. What's the question behind your question?