MCPcopy
hub / github.com/angular-ui/ui-router / addDirective

Function addDirective

test/angular/1.7/angular.js:10749–10775  ·  view source on GitHub ↗

* looks up the directive and decorates it with exception handling and proper parameters. We * call this the boundDirective. * * @param {string} name name of the directive to look up. * @param {string} location The directive must be found in specific format. * String contai

(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,
                          endAttrName)

Source from the content-addressed store, hash-verified

10747 * @returns {boolean} true if directive was added.
10748 */
10749 function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,
10750 endAttrName) {
10751 if (name === ignoreDirective) return null;
10752 var match = null;
10753 if (hasDirectives.hasOwnProperty(name)) {
10754 for (var directive, directives = $injector.get(name + Suffix),
10755 i = 0, ii = directives.length; i < ii; i++) {
10756 directive = directives[i];
10757 if ((isUndefined(maxPriority) || maxPriority > directive.priority) &&
10758 directive.restrict.indexOf(location) !== -1) {
10759 if (startAttrName) {
10760 directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});
10761 }
10762 if (!directive.$$bindings) {
10763 var bindings = directive.$$bindings =
10764 parseDirectiveBindings(directive, directive.name);
10765 if (isObject(bindings.isolateScope)) {
10766 directive.$$isolateBindings = bindings.isolateScope;
10767 }
10768 }
10769 tDirectives.push(directive);
10770 match = directive;
10771 }
10772 }
10773 }
10774 return match;
10775 }
10776
10777
10778 /**

Callers 2

collectDirectivesFunction · 0.70
collectCommentDirectivesFunction · 0.70

Calls 4

isUndefinedFunction · 0.70
inheritFunction · 0.70
parseDirectiveBindingsFunction · 0.70
isObjectFunction · 0.70

Tested by

no test coverage detected