MCPcopy Create free account
hub / github.com/cafebazaar/blacksmith / addDirective

Function addDirective

web/static/bower_components/angular/angular.js:8342–8363  ·  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

8340 * @returns {boolean} true if directive was added.
8341 */
8342 function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,
8343 endAttrName) {
8344 if (name === ignoreDirective) return null;
8345 var match = null;
8346 if (hasDirectives.hasOwnProperty(name)) {
8347 for (var directive, directives = $injector.get(name + Suffix),
8348 i = 0, ii = directives.length; i < ii; i++) {
8349 try {
8350 directive = directives[i];
8351 if ((isUndefined(maxPriority) || maxPriority > directive.priority) &&
8352 directive.restrict.indexOf(location) != -1) {
8353 if (startAttrName) {
8354 directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});
8355 }
8356 tDirectives.push(directive);
8357 match = directive;
8358 }
8359 } catch (e) { $exceptionHandler(e); }
8360 }
8361 }
8362 return match;
8363 }
8364
8365
8366 /**

Callers 1

collectDirectivesFunction · 0.85

Calls 3

isUndefinedFunction · 0.85
getMethod · 0.80
inheritFunction · 0.70

Tested by

no test coverage detected