/
githubmirror
/
angular.js
Обзор
Документация
Войти
/
githubmirror
/
angular.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
docs/config/templates/ngdoc/api/directive.template.html
86 строк
3 KB
Martin Staffa
chore(doc-gen): add directive names that aren't params to usage section
18 окт 2017, 14:29
18 окт 2017, 14:29
69e0968
Код
Авторство
О чём код?
{% import "lib/macros.html" as lib -%} {% extends "api/api.template.html" %} {% block additional %} <h2 id="{$ doc.name $}-info">Directive Info</h2> <ul> {% if doc.scope %}<li>This directive creates new scope.</li>{% endif %} <li>This directive executes at priority level {$ doc.priority $}.</li> {% if doc.multiElement %}<li>This directive can be used as {@link $compile#-multielement- multiElement}</li>{% endif %} </ul> {% block usage %} <h2 id="usage">Usage</h2> <div class="usage"> {% if doc.usage %} {$ doc.usage | marked $} {% else %} <ul> {% if doc.restrict.element %} <li>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 %} </li> {% 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 -%} <li>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 %} </li> {% endif -%} {%- if doc.restrict.cssClass -%} <li>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 %} </li> {% endif -%} {%- endif %} </div> {% endblock -%} {% include "lib/params.template.html" %} {% include "lib/events.template.html" %} {%- if doc.animations %} <h2 id="animations">Animations</h2> {$ doc.animations | marked $} {$ 'module:ngAnimate.$animate' | link('Click here', doc) $} to learn more about the steps involved in the animation. {%- endif -%} {% endblock %}