MCPcopy Index your code
hub / github.com/angular-ui/ui-router / nodeLinkFn

Function nodeLinkFn

test/angular/1.3/angular.js:7621–7820  ·  view source on GitHub ↗
(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn)

Source from the content-addressed store, hash-verified

7619
7620
7621 function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
7622 var i, ii, linkFn, controller, isolateScope, elementControllers, transcludeFn, $element,
7623 attrs;
7624
7625 if (compileNode === linkNode) {
7626 attrs = templateAttrs;
7627 $element = templateAttrs.$$element;
7628 } else {
7629 $element = jqLite(linkNode);
7630 attrs = new Attributes($element, templateAttrs);
7631 }
7632
7633 if (newIsolateScopeDirective) {
7634 isolateScope = scope.$new(true);
7635 }
7636
7637 if (boundTranscludeFn) {
7638 // track `boundTranscludeFn` so it can be unwrapped if `transcludeFn`
7639 // is later passed as `parentBoundTranscludeFn` to `publicLinkFn`
7640 transcludeFn = controllersBoundTransclude;
7641 transcludeFn.$$boundTransclude = boundTranscludeFn;
7642 }
7643
7644 if (controllerDirectives) {
7645 // TODO: merge `controllers` and `elementControllers` into single object.
7646 controllers = {};
7647 elementControllers = {};
7648 forEach(controllerDirectives, function(directive) {
7649 var locals = {
7650 $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,
7651 $element: $element,
7652 $attrs: attrs,
7653 $transclude: transcludeFn
7654 }, controllerInstance;
7655
7656 controller = directive.controller;
7657 if (controller == '@') {
7658 controller = attrs[directive.name];
7659 }
7660
7661 controllerInstance = $controller(controller, locals, true, directive.controllerAs);
7662
7663 // For directives with element transclusion the element is a comment,
7664 // but jQuery .data doesn't support attaching data to comment nodes as it's hard to
7665 // clean up (http://bugs.jquery.com/ticket/8335).
7666 // Instead, we save the controllers for the element in a local hash and attach to .data
7667 // later, once we have the actual element.
7668 elementControllers[directive.name] = controllerInstance;
7669 if (!hasElementTranscludeDirective) {
7670 $element.data('$' + directive.name + 'Controller', controllerInstance.instance);
7671 }
7672
7673 controllers[directive.name] = controllerInstance;
7674 });
7675 }
7676
7677 if (newIsolateScopeDirective) {
7678 compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective ||

Callers 1

compositeLinkFnFunction · 0.70

Calls 6

controllerFunction · 0.85
forEachFunction · 0.70
$interpolateFunction · 0.70
invokeLinkFnFunction · 0.70
getControllersFunction · 0.70
$parseFunction · 0.50

Tested by

no test coverage detected