fix(ivy): ngtsc should correctly bind to context in nested template with many bindings (#28982)

PR Close #28982
This commit is contained in:
Marc Laval
2019-02-26 18:35:30 +01:00
committed by Ben Lesh
parent 25a2fef303
commit 8f8f9a6e61
3 changed files with 59 additions and 25 deletions

View File

@ -1431,7 +1431,8 @@ export class BindingScope implements LocalResolver {
}
maybeGenerateSharedContextVar(value: BindingData) {
if (value.priority === DeclarationPriority.CONTEXT) {
if (value.priority === DeclarationPriority.CONTEXT &&
value.retrievalLevel < this.bindingLevel) {
const sharedCtxObj = this.map.get(SHARED_CONTEXT_KEY + value.retrievalLevel);
if (sharedCtxObj) {
sharedCtxObj.declare = true;