Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIf Data-binding an empty Array in template, the state will be retained #37687
Labels
Milestone
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Affected Package
The issue is caused by package @angular/....Is this a regression?
Description
I binding an empty Array in template as below. And click the ADD button to make some changes. When I click the Rebuild button, app-level-1 component will rebuild(its ngOnInit function will be called). And I expect it always input an empty Array into the sub-component. Actually the binding data will be retained. As a comparison, the the binding data in other two component will be reset.
Even if I deepen the level componet, rebuild all of them, the binding data still here, so maybe it stored in the entire angular lifecycle.
I found out how bugs happen:
the new component binding a Array as the old component instead of empty Array.
🔬 Minimal Reproduction
https://stackblitz.com/edit/angular-zkdxh1Angular Version:
Anything else relevant?
It happend in Angular 7