diff options
| author | Igor Minar | 2013-10-21 17:38:43 -0700 | 
|---|---|---|
| committer | Igor Minar | 2013-10-24 13:54:15 -0700 | 
| commit | faf5b980da09da2b4c28f1feab33f87269f9f0ba (patch) | |
| tree | ca03fa2156eaa8389367690972bda2b4e6ade396 /src/ng/compile.js | |
| parent | e57d5b89caac88a11696e88ccdd5404f77663447 (diff) | |
| download | angular.js-faf5b980da09da2b4c28f1feab33f87269f9f0ba.tar.bz2 | |
fix($compile): instantiate controlers when re-entering compilation
When we re-enter compilation either due to async directive templates or element transclude directive
we need to keep track of controllers to instantiate during linking.
This piece of info was missing when re-entering compilation and that's what this commit fixes.
I also reordered the properties in the previousCompileContext object.
Closes #4434
Closes #4616
Diffstat (limited to 'src/ng/compile.js')
| -rw-r--r-- | src/ng/compile.js | 18 | 
1 files changed, 10 insertions, 8 deletions
| diff --git a/src/ng/compile.js b/src/ng/compile.js index 2ff9144b..e6300f15 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -1117,16 +1117,16 @@ function $CompileProvider($provide) {        var terminalPriority = -Number.MAX_VALUE,            newScopeDirective, +          controllerDirectives = previousCompileContext.controllerDirectives,            newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,            templateDirective = previousCompileContext.templateDirective, +          transcludeDirective = previousCompileContext.transcludeDirective,            $compileNode = templateAttrs.$$element = jqLite(compileNode),            directive,            directiveName,            $template, -          transcludeDirective = previousCompileContext.transcludeDirective,            replaceDirective = originalReplaceDirective,            childTranscludeFn = transcludeFn, -          controllerDirectives,            linkFn,            directiveValue; @@ -1191,9 +1191,10 @@ function $CompileProvider($provide) {              childTranscludeFn = compile($template, transcludeFn, terminalPriority,                                          replaceDirective && replaceDirective.name, { +                                          controllerDirectives: controllerDirectives,                                            newIsolateScopeDirective: newIsolateScopeDirective, -                                          transcludeDirective: transcludeDirective, -                                          templateDirective: templateDirective +                                          templateDirective: templateDirective, +                                          transcludeDirective: transcludeDirective                                          });            } else {              $template = jqLite(jqLiteClone(compileNode)).contents(); @@ -1259,9 +1260,10 @@ function $CompileProvider($provide) {            nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,                templateAttrs, jqCollection, childTranscludeFn, preLinkFns, postLinkFns, { +                controllerDirectives: controllerDirectives,                  newIsolateScopeDirective: newIsolateScopeDirective, -                transcludeDirective: transcludeDirective, -                templateDirective: templateDirective +                templateDirective: templateDirective, +                transcludeDirective: transcludeDirective                });            ii = directives.length;          } else if (directive.compile) { @@ -1415,7 +1417,7 @@ function $CompileProvider($provide) {                    return parentGet(parentScope, locals);                  };                  break; -               +                default:                  throw $compileMinErr('iscp',                      "Invalid isolate scope definition for directive '{0}'." + @@ -1819,7 +1821,7 @@ function directiveNormalize(name) {  /**   * @ngdoc object   * @name ng.$compile.directive.Attributes - *  + *   * @description   * A shared object between directive compile / linking functions which contains normalized DOM   * element attributes. The the values reflect current binding state `{{ }}`. The normalization is | 
