Back to Angular Js

Directive.Template

docs/config/templates/ngdoc/api/directive.template.html

1.8.32.0 KB
Original Source

{% import "lib/macros.html" as lib -%} {% extends "api/api.template.html" %} {% block additional %}

Directive Info

{% if doc.scope %}- This directive creates new scope. {% endif %} - This directive executes at priority level {$ doc.priority $}. {% if doc.multiElement %}- This directive can be used as {@link $compile#-multielement- multiElement} {% endif %} {% block usage %}

Usage

{% if doc.usage %} {$ doc.usage | marked $} {% else %} {% if doc.restrict.element %} - as element: {% code %} <{$ doc.name | dashCase $} {%- for param in doc.params %} {$ lib.directiveParam(param.alias or param.name, param.type, '="', '"') $} {%- endfor %}> ... {$ doc.name | dashCase $}> {% endcode %} {% endif -%} {% set hasNameAsParam = false %} {# when a directive's name is not a parameter (i.e. doesn't take a value), add the directive name to the list of attributes and/or css classes #} {%- for param in doc.params %} {% set hasNameAsParam = true if param.name === doc.name else hasNameAsParam %} {%- endfor %} {%- if doc.restrict.attribute -%} - as attribute: {% code %} <{$ doc.element $} {%- if not hasNameAsParam %} {$ lib.directiveParam(doc.name, {}, '', '') $} {%- endif -%} {%- for param in doc.params %} {$ lib.directiveParam(param.name, param.type, '="', '"') $} {%- endfor %}> ... {$ doc.element $}> {% endcode %} {% endif -%} {%- if doc.restrict.cssClass -%} - as CSS class: {% code %} {% set sep = joiner(' ') %} <{$ doc.element $} class=" {%- if not hasNameAsParam -%} {$ sep() $}{$ lib.directiveParam(doc.name, {}, '', '') $} {%- endif -%} {%- for param in doc.params -%} {$ sep() $}{$ lib.directiveParam(param.name, param.type, ': ', ';') $} {%- endfor %}"> ... {$ doc.element $}> {% endcode %} {% endif -%} {%- endif %}

{% endblock -%} {% include "lib/params.template.html" %} {% include "lib/events.template.html" %} {%- if doc.animations %}

Animations

{$ doc.animations | marked $} {$ 'module:ngAnimate.$animate' | link('Click here', doc) $} to learn more about the steps involved in the animation. {%- endif -%} {% endblock %}