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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding break when an object attribute is deleted #381

Closed
hadrienl opened this issue Mar 25, 2016 · 2 comments
Closed

Binding break when an object attribute is deleted #381

hadrienl opened this issue Mar 25, 2016 · 2 comments

Comments

@hadrienl
Copy link

If I bind an object attribute in a template and I delete one, then the view is no more updated. You can see a demo in this plnkr. The first button set value to null, the second button delete the value.

@jdanyow
Copy link
Contributor

jdanyow commented Mar 26, 2016

Deleting properties that are being observed is not supported. The binding system rewrites properties it's observing with a getter and setter. This enabled the binding system to intercept property assignments and handle the property change. Deleting the property will put things in a bad state.

@EisenbergEffect
Copy link
Contributor

Also, you don't want to delete properites, usually for performance sake, because that changes the JS runtime's "shape" understanding of the object, which is costly. It's better to simply set the property's value to undefined or null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants