Restricting Directive Behavior

You can apply a directive as an HTML element, an attribute, or both. The restrict property enables you to limit how your custom directive can be applied. The restrict property can be set to the following:

A: Applied as an attribute name. For example:

<my-directive></my-directive>

E: Applied as an element name. For example:

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

C: Applied as a class. For example:

<div class="my-directive: expression;"></div>

M: Applied as a comment. For example:

<!-- directive: my-directive expression -->

AEC: Applied as an attribute, an element, or a class name. You can ...

Get Learning AngularJS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.