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

Function nodeLinkFn

test/angular/1.2/angular.js:6626–6802  ·  view source on GitHub ↗
(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn)

Source from the content-addressed store, hash-verified

6624
6625
6626 function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
6627 var attrs, $element, i, ii, linkFn, controller, isolateScope, elementControllers = {}, transcludeFn;
6628
6629 attrs = (compileNode === linkNode)
6630 ? templateAttrs
6631 : shallowCopy(templateAttrs, new Attributes(jqLite(linkNode), templateAttrs.$attr));
6632 $element = attrs.$$element;
6633
6634 if (newIsolateScopeDirective) {
6635 var LOCAL_REGEXP = /^\s*([@=&])(\??)\s*(\w*)\s*$/;
6636
6637 isolateScope = scope.$new(true);
6638
6639 if (templateDirective && (templateDirective === newIsolateScopeDirective ||
6640 templateDirective === newIsolateScopeDirective.$$originalDirective)) {
6641 $element.data('$isolateScope', isolateScope);
6642 } else {
6643 $element.data('$isolateScopeNoTemplate', isolateScope);
6644 }
6645
6646
6647
6648 safeAddClass($element, 'ng-isolate-scope');
6649
6650 forEach(newIsolateScopeDirective.scope, function(definition, scopeName) {
6651 var match = definition.match(LOCAL_REGEXP) || [],
6652 attrName = match[3] || scopeName,
6653 optional = (match[2] == '?'),
6654 mode = match[1], // @, =, or &
6655 lastValue,
6656 parentGet, parentSet, compare;
6657
6658 isolateScope.$$isolateBindings[scopeName] = mode + attrName;
6659
6660 switch (mode) {
6661
6662 case '@':
6663 attrs.$observe(attrName, function(value) {
6664 isolateScope[scopeName] = value;
6665 });
6666 attrs.$$observers[attrName].$$scope = scope;
6667 if( attrs[attrName] ) {
6668 // If the attribute has been provided then we trigger an interpolation to ensure
6669 // the value is there for use in the link fn
6670 isolateScope[scopeName] = $interpolate(attrs[attrName])(scope);
6671 }
6672 break;
6673
6674 case '=':
6675 if (optional && !attrs[attrName]) {
6676 return;
6677 }
6678 parentGet = $parse(attrs[attrName]);
6679 if (parentGet.literal) {
6680 compare = equals;
6681 } else {
6682 compare = function(a,b) { return a === b || (a !== a && b !== b); };
6683 }

Callers 1

compositeLinkFnFunction · 0.70

Calls 9

matchMethod · 0.80
shallowCopyFunction · 0.70
safeAddClassFunction · 0.70
forEachFunction · 0.70
$interpolateFunction · 0.70
compareFunction · 0.70
getControllersFunction · 0.70
startingTagFunction · 0.70
$parseFunction · 0.50

Tested by

no test coverage detected