MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / addDirective

Function addDirective

code/songhop/www/lib/angular/angular.js:7759–7780  ·  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

7757 * @returns {boolean} true if directive was added.
7758 */
7759 function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,
7760 endAttrName) {
7761 if (name === ignoreDirective) return null;
7762 var match = null;
7763 if (hasDirectives.hasOwnProperty(name)) {
7764 for (var directive, directives = $injector.get(name + Suffix),
7765 i = 0, ii = directives.length; i < ii; i++) {
7766 try {
7767 directive = directives[i];
7768 if ((maxPriority === undefined || maxPriority > directive.priority) &&
7769 directive.restrict.indexOf(location) != -1) {
7770 if (startAttrName) {
7771 directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});
7772 }
7773 tDirectives.push(directive);
7774 match = directive;
7775 }
7776 } catch (e) { $exceptionHandler(e); }
7777 }
7778 }
7779 return match;
7780 }
7781
7782
7783 /**

Callers 1

collectDirectivesFunction · 0.70

Calls 2

getMethod · 0.80
inheritFunction · 0.70

Tested by

no test coverage detected