Angular watch with edit - which property has been changed

I have an object with deep observation (true in the third argument of $ watch). When the watch fires, I want to know which property has been changed. All I get is new and old value. Is there a good way to find out what has changed? I do not want to compare new and old objects and look for changed properties.

+4
source share
1 answer

Not the cleanest way, but not the clean AngularJS method to solve this, is to use the Object.observe()object instead of $ watch, because it passes the name of the changed property.

External Links for Object.observe ()


, , . , .

0

Source: https://habr.com/ru/post/1532003/


All Articles