Tips for Angular Directives || Tips en Directivas de Angular

The Restrict Option || La opcion Restrict

We have four different types of representations a directive can have, and all of them are denoted by the Restrict option listed as follows. || Tenemos cuatro tipos diferentes de representaciones para las directivas, todas ellas se denotan por la opcion Restrict, esas opciones son las siguientes.

What is the restrict option? || Que es la opcion de restrict?

  • Restrict: 'A' – This option represents the directive that is an attribute || atributo of the element (default), which implies that Angular is looking for

    <div my-directive> </div>


  • Restrict: 'E' – This option represents the directive that is an element || elemento, which implies that Angular is looking for

    <my-directive> </my-directive>


  • Restrict: 'C' – This option represents the directive that is a || Esta opción representa que la directiva esta class definition || definida como clase, which implies that Angular is looking for || lo cual implica que Angular esta esperando por

    <div class="my-directive"></div>


  • Restrict: 'M' – This option represents the directive that is a comment || comentario, which implies that Angular is looking for

    <!-- directive: my-directiveattrs-->

Do you would like to share it? || Te gustaria compartirlo con otros?