AngularJS - Directives: Element or Attribute

2

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?

    
asked by anonymous 06.02.2016 / 21:01

1 answer

3

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.

    
06.02.2016 / 21:09