Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

User ngTemplateOutletContext been modified unexpectedly #40385

Closed
JounQin opened this issue Jan 11, 2021 · 3 comments
Closed

User ngTemplateOutletContext been modified unexpectedly #40385

JounQin opened this issue Jan 11, 2021 · 3 comments

Comments

@JounQin
Copy link
Contributor

JounQin commented Jan 11, 2021

馃悶 bug report

Affected Package

The issue is caused by package @angular/core

Is this a regression?

No

Description

User ngTemplateOutletContext is been modified at https://github.com/angular/angular/blob/master/packages/common/src/directives/ng_template_outlet.ts#L104 because the _viewRef.context is pointed at https://github.com/angular/angular/blob/master/packages/core/src/render3/instructions/shared.ts#L137.

馃敩 Minimal Reproduction

https://stackblitz.com/edit/angular-ivy-tstyd6?file=src%2Fcomponents%2Fselect.component.ts

馃敟 Exception or Error

Click label: option2-5, the top value will change correctly, be then click label: option1 the top value will not change which is incorrect.

This is because the ngTemplateOutletContext is pointed to the first context and always been modified, but when clicking label: option1, the context has been changed to last context content https://github.com/angular/angular/blob/master/packages/common/src/directives/ng_template_outlet.ts#L68.

馃實 Your Environment

Angular Version:




Angular CLI: 11.0.3
Node: 12.20.0
OS: darwin x64

Angular: 11.0.3
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1002.0
@angular-devkit/core         10.2.0
@angular-devkit/schematics   11.0.3
@angular/cdk                 11.0.2
@angular/flex-layout         11.0.0-beta.33
@schematics/angular          11.0.3
@schematics/update           0.1100.3
rxjs                         6.6.3
typescript                   4.1.2

Anything else relevant?

@crisbeto
Copy link
Member

Should be fixed by #40360. Also see the PR for more context around why it currently works this way.

@JounQin
Copy link
Contributor Author

JounQin commented Jan 11, 2021

@crisbeto Thanks for your reply. Close in favor of #24515.

@JounQin JounQin closed this as completed Jan 11, 2021
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants