MCPcopy Create free account
hub / github.com/bclinkinbeard/angular / nodeLinkFn

Function nodeLinkFn

test/fixtures/foo.js:6551–6727  ·  view source on GitHub ↗
(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn)

Source from the content-addressed store, hash-verified

6549
6550
6551 function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
6552 var attrs, $element, i, ii, linkFn, controller, isolateScope, elementControllers = {}, transcludeFn;
6553
6554 attrs = (compileNode === linkNode)
6555 ? templateAttrs
6556 : shallowCopy(templateAttrs, new Attributes(jqLite(linkNode), templateAttrs.$attr));
6557 $element = attrs.$$element;
6558
6559 if (newIsolateScopeDirective) {
6560 var LOCAL_REGEXP = /^\s*([@=&])(\??)\s*(\w*)\s*$/;
6561
6562 isolateScope = scope.$new(true);
6563
6564 if (templateDirective && (templateDirective === newIsolateScopeDirective ||
6565 templateDirective === newIsolateScopeDirective.$$originalDirective)) {
6566 $element.data('$isolateScope', isolateScope);
6567 } else {
6568 $element.data('$isolateScopeNoTemplate', isolateScope);
6569 }
6570
6571
6572
6573 safeAddClass($element, 'ng-isolate-scope');
6574
6575 forEach(newIsolateScopeDirective.scope, function(definition, scopeName) {
6576 var match = definition.match(LOCAL_REGEXP) || [],
6577 attrName = match[3] || scopeName,
6578 optional = (match[2] == '?'),
6579 mode = match[1], // @, =, or &
6580 lastValue,
6581 parentGet, parentSet, compare;
6582
6583 isolateScope.$$isolateBindings[scopeName] = mode + attrName;
6584
6585 switch (mode) {
6586
6587 case '@':
6588 attrs.$observe(attrName, function(value) {
6589 isolateScope[scopeName] = value;
6590 });
6591 attrs.$$observers[attrName].$$scope = scope;
6592 if( attrs[attrName] ) {
6593 // If the attribute has been provided then we trigger an interpolation to ensure
6594 // the value is there for use in the link fn
6595 isolateScope[scopeName] = $interpolate(attrs[attrName])(scope);
6596 }
6597 break;
6598
6599 case '=':
6600 if (optional && !attrs[attrName]) {
6601 return;
6602 }
6603 parentGet = $parse(attrs[attrName]);
6604 if (parentGet.literal) {
6605 compare = equals;
6606 } else {
6607 compare = function(a,b) { return a === b || (a !== a && b !== b); };
6608 }

Callers 1

compositeLinkFnFunction · 0.85

Calls 7

shallowCopyFunction · 0.85
safeAddClassFunction · 0.85
forEachFunction · 0.85
$interpolateFunction · 0.85
compareFunction · 0.85
getControllersFunction · 0.85
startingTagFunction · 0.85

Tested by

no test coverage detected