($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective)
| 9649 | } |
| 9650 | |
| 9651 | function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective) { |
| 9652 | var elementControllers = createMap(); |
| 9653 | for (var controllerKey in controllerDirectives) { |
| 9654 | var directive = controllerDirectives[controllerKey]; |
| 9655 | var locals = { |
| 9656 | $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope, |
| 9657 | $element: $element, |
| 9658 | $attrs: attrs, |
| 9659 | $transclude: transcludeFn |
| 9660 | }; |
| 9661 | |
| 9662 | var controller = directive.controller; |
| 9663 | if (controller === '@') { |
| 9664 | controller = attrs[directive.name]; |
| 9665 | } |
| 9666 | |
| 9667 | var controllerInstance = $controller(controller, locals, true, directive.controllerAs); |
| 9668 | |
| 9669 | // For directives with element transclusion the element is a comment. |
| 9670 | // In this case .data will not attach any data. |
| 9671 | // Instead, we save the controllers for the element in a local hash and attach to .data |
| 9672 | // later, once we have the actual element. |
| 9673 | elementControllers[directive.name] = controllerInstance; |
| 9674 | $element.data('$' + directive.name + 'Controller', controllerInstance.instance); |
| 9675 | } |
| 9676 | return elementControllers; |
| 9677 | } |
| 9678 | |
| 9679 | // Depending upon the context in which a directive finds itself it might need to have a new isolated |
| 9680 | // or child scope created. For instance: |
no test coverage detected