diff options
| author | Vojta Jina | 2013-11-05 12:27:56 -0800 | 
|---|---|---|
| committer | Igor Minar | 2013-11-07 22:08:04 -0800 | 
| commit | d0efd5eefcc0aaf167c766513e152b74dd31bafe (patch) | |
| tree | 6afd4cd397adeba0392c2b0272f2feb26834f8c1 /src/ng/compile.js | |
| parent | 909cabd36d779598763cc358979ecd85bb40d4d7 (diff) | |
| download | angular.js-d0efd5eefcc0aaf167c766513e152b74dd31bafe.tar.bz2 | |
fix($compile): only pass isolate scope to children that belong to the isolate directive
I had to fix one unit test, as it assumed the broken behavior, where application template gets the
isolate scope of other (isolate) directive, rather than the regular scope.
BREAKING CHANGE: Child elements that are defined either in the application template or in some other
directives template do not get the isolate scope. In theory, nobody should rely on this behavior, as
it is very rare - in most cases the isolate directive has a template.
Diffstat (limited to 'src/ng/compile.js')
| -rw-r--r-- | src/ng/compile.js | 9 | 
1 files changed, 7 insertions, 2 deletions
| diff --git a/src/ng/compile.js b/src/ng/compile.js index adcbb6af..7616aa07 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -1480,8 +1480,13 @@ function $CompileProvider($provide) {          }          // RECURSION -        // TODO(vojta): only pass isolate if the isolate directive has template -        childLinkFn && childLinkFn(isolateScope || scope, linkNode.childNodes, undefined, boundTranscludeFn); +        // We only pass the isolate scope, if the isolate directive has a template, +        // otherwise the child elements do not belong to the isolate directive. +        var scopeToChild = scope; +        if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) { +          scopeToChild = isolateScope; +        } +        childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);          // POSTLINKING          for(i = postLinkFns.length - 1; i >= 0; i--) { | 
