diff options
| author | Chirayu Krishnappa | 2013-08-09 19:56:10 -0700 | 
|---|---|---|
| committer | Chirayu Krishnappa | 2013-08-20 18:51:07 -0700 | 
| commit | 51d32243fe8cfbdcd1b647950d4e99ed57677558 (patch) | |
| tree | b50d179ba51cdb8b4e6eb4fcdba90607b25cd11f /src | |
| parent | 1c1a1bc9eda5497010506d16fe4f1b5e224d289e (diff) | |
| download | angular.js-51d32243fe8cfbdcd1b647950d4e99ed57677558.tar.bz2 | |
fix($compile): correct controller instantiation for async directives
This fixes regression introduced by #3514 (9c51d503) - this commit is being
reverted here and a better fix is included.
The regression caused the controller to be instantiated before the isolate scope
was initialized.
Closes #3493
Closes #3482
Closes #3537
Closes #3540
Diffstat (limited to 'src')
| -rw-r--r-- | src/ng/compile.js | 23 | 
1 files changed, 12 insertions, 11 deletions
| diff --git a/src/ng/compile.js b/src/ng/compile.js index dbecd3b1..9e124edb 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -621,6 +621,13 @@ function $CompileProvider($provide) {          directiveName = directive.name; +        if (directiveValue = directive.controller) { +          controllerDirectives = controllerDirectives || {}; +          assertNoDuplicate("'" + directiveName + "' controller", +              controllerDirectives[directiveName], directive, $compileNode); +          controllerDirectives[directiveName] = directive; +        } +          if (directiveValue = directive.transclude) {            assertNoDuplicate('transclusion', transcludeDirective, directive, $compileNode);            transcludeDirective = directive; @@ -698,13 +705,6 @@ function $CompileProvider($provide) {            }          } -        if (!directive.templateUrl && directive.controller) { -          controllerDirectives = controllerDirectives || {}; -          assertNoDuplicate("'" + directiveName + "' controller", -              controllerDirectives[directiveName], directive, $compileNode); -          controllerDirectives[directiveName] = directive; -        } -          if (directive.terminal) {            nodeLinkFn.terminal = true;            terminalPriority = Math.max(terminalPriority, directive.priority); @@ -962,7 +962,7 @@ function $CompileProvider($provide) {            origAsyncDirective = directives.shift(),            // The fact that we have to copy and patch the directive seems wrong!            derivedSyncDirective = extend({}, origAsyncDirective, { -            templateUrl: null, transclude: null, scope: null +            controller: null, templateUrl: null, transclude: null, scope: null            });        $compileNode.html(''); @@ -1008,9 +1008,10 @@ function $CompileProvider($provide) {                replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);              } -            afterTemplateNodeLinkFn(function() { -              beforeTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement, controller); -            }, scope, linkNode, $rootElement, controller); +            afterTemplateNodeLinkFn( +              beforeTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement, controller), +              scope, linkNode, $rootElement, controller +            );            }            linkQueue = null;          }). | 
