($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective)
| 10758 | } |
| 10759 | |
| 10760 | function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective) { |
| 10761 | var elementControllers = createMap(); |
| 10762 | for (var controllerKey in controllerDirectives) { |
| 10763 | var directive = controllerDirectives[controllerKey]; |
| 10764 | var locals = { |
| 10765 | $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope, |
| 10766 | $element: $element, |
| 10767 | $attrs: attrs, |
| 10768 | $transclude: transcludeFn |
| 10769 | }; |
| 10770 | |
| 10771 | var controller = directive.controller; |
| 10772 | if (controller === '@') { |
| 10773 | controller = attrs[directive.name]; |
| 10774 | } |
| 10775 | |
| 10776 | var controllerInstance = $controller(controller, locals, true, directive.controllerAs); |
| 10777 | |
| 10778 | // For directives with element transclusion the element is a comment. |
| 10779 | // In this case .data will not attach any data. |
| 10780 | // Instead, we save the controllers for the element in a local hash and attach to .data |
| 10781 | // later, once we have the actual element. |
| 10782 | elementControllers[directive.name] = controllerInstance; |
| 10783 | $element.data('$' + directive.name + 'Controller', controllerInstance.instance); |
| 10784 | } |
| 10785 | return elementControllers; |
| 10786 | } |
| 10787 | |
| 10788 | // Depending upon the context in which a directive finds itself it might need to have a new isolated |
| 10789 | // or child scope created. For instance: |
no test coverage detected