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

Function setupControllers

test/angular/1.4/angular.js:8466–8492  ·  view source on GitHub ↗
($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope)

Source from the content-addressed store, hash-verified

8464 }
8465
8466 function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope) {
8467 var elementControllers = createMap();
8468 for (var controllerKey in controllerDirectives) {
8469 var directive = controllerDirectives[controllerKey];
8470 var locals = {
8471 $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,
8472 $element: $element,
8473 $attrs: attrs,
8474 $transclude: transcludeFn
8475 };
8476
8477 var controller = directive.controller;
8478 if (controller == '@') {
8479 controller = attrs[directive.name];
8480 }
8481
8482 var controllerInstance = $controller(controller, locals, true, directive.controllerAs);
8483
8484 // For directives with element transclusion the element is a comment.
8485 // In this case .data will not attach any data.
8486 // Instead, we save the controllers for the element in a local hash and attach to .data
8487 // later, once we have the actual element.
8488 elementControllers[directive.name] = controllerInstance;
8489 $element.data('$' + directive.name + 'Controller', controllerInstance.instance);
8490 }
8491 return elementControllers;
8492 }
8493
8494 function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
8495 var linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element,

Callers 1

nodeLinkFnFunction · 0.70

Calls 1

createMapFunction · 0.70

Tested by

no test coverage detected