I'm new to angularJS and I'm seeing the directives part, and I see that there is the restrict element and restrict attribute. I understood what each one does, but it was not clear when to use one or the other, or both?
I'm new to angularJS and I'm seeing the directives part, and I see that there is the restrict element and restrict attribute. I understood what each one does, but it was not clear when to use one or the other, or both?
You are free to use both as you please, but in some cases it is worth using instead of the other.
Directives as an element is a good request when you are working with repeating HTML strings that could be isolated for example, but nothing prevents you from using directives as attributes to perform the same procedure.
Directives as an attribute is a good request for validations on elements of type input for example, but in this case it would not be possible to do the same through directives as element.