($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope)
| 8158 | } |
| 8159 | |
| 8160 | function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope) { |
| 8161 | var elementControllers = createMap(); |
| 8162 | for (var controllerKey in controllerDirectives) { |
| 8163 | var directive = controllerDirectives[controllerKey]; |
| 8164 | var locals = { |
| 8165 | $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope, |
| 8166 | $element: $element, |
| 8167 | $attrs: attrs, |
| 8168 | $transclude: transcludeFn |
| 8169 | }; |
| 8170 | |
| 8171 | var controller = directive.controller; |
| 8172 | if (controller == '@') { |
| 8173 | controller = attrs[directive.name]; |
| 8174 | } |
| 8175 | |
| 8176 | var controllerInstance = $controller(controller, locals, true, directive.controllerAs); |
| 8177 | |
| 8178 | // For directives with element transclusion the element is a comment, |
| 8179 | // but jQuery .data doesn't support attaching data to comment nodes as it's hard to |
| 8180 | // clean up (http://bugs.jquery.com/ticket/8335). |
| 8181 | // Instead, we save the controllers for the element in a local hash and attach to .data |
| 8182 | // later, once we have the actual element. |
| 8183 | elementControllers[directive.name] = controllerInstance; |
| 8184 | if (!hasElementTranscludeDirective) { |
| 8185 | $element.data('$' + directive.name + 'Controller', controllerInstance.instance); |
| 8186 | } |
| 8187 | } |
| 8188 | return elementControllers; |
| 8189 | } |
| 8190 | |
| 8191 | function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn, |
| 8192 | thisLinkFn) { |
no test coverage detected