-
Notifications
You must be signed in to change notification settings - Fork 27.1k
ngTemplateOutlet modifies its initial context when getting a new context whose shape is the same #24515
Description
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:
Current behavior
ngTemplateOutlet modifies the previous context when getting a new context whose shape is the same.
Expected behavior
ngTemplateOutlet should not change its context parameters in any case.
Minimal reproduction of the problem with instructions
Click on "Swap". The contexts of the ngTemplateOutlets directives are swapped.
We should see "name = context 2" on the first line and "name = context 1" on the second line, but both lines show "name = context 2". The first ngTemplateOutlet has changed the name property of the first context when receiving the second context.
Note that the problem does not happen if the contexts do not have exactly the same set of properties (for example, when adding "foo: true" in the first context but not in the second, the behavior of ngTemplateOutlet is correct).
What is the motivation / use case for changing the behavior?
It is clearly a bug. It is confusing.
Environment
Angular version: 6.0.0
Browser: all