MCPcopy Create free account
hub / github.com/angular-ui/ui-router / addDirective

Function addDirective

test/angular/1.2/angular.js:6826–6847  ·  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

6824 * @returns {boolean} true if directive was added.
6825 */
6826 function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,
6827 endAttrName) {
6828 if (name === ignoreDirective) return null;
6829 var match = null;
6830 if (hasDirectives.hasOwnProperty(name)) {
6831 for(var directive, directives = $injector.get(name + Suffix),
6832 i = 0, ii = directives.length; i<ii; i++) {
6833 try {
6834 directive = directives[i];
6835 if ( (maxPriority === undefined || maxPriority > directive.priority) &&
6836 directive.restrict.indexOf(location) != -1) {
6837 if (startAttrName) {
6838 directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});
6839 }
6840 tDirectives.push(directive);
6841 match = directive;
6842 }
6843 } catch(e) { $exceptionHandler(e); }
6844 }
6845 }
6846 return match;
6847 }
6848
6849
6850 /**

Callers 1

collectDirectivesFunction · 0.70

Calls 1

inheritFunction · 0.70

Tested by

no test coverage detected