Open Toilal opened 9 years ago
This was discussed before #2871, the main issue always came back to one of these points
clone
That said, I would like to have a PR in place and discuss these point there
@lgalfaso This the PR here : https://github.com/angular/angular.js/pull/10096
It would be useful to be able to pass a function as the 3rd parameter
objectEquality
of $scope.$watch.If a function is passed, is will be used instead of angular.equals to check for object equality.
It could also provide better performance by implementing specific equality function for watched object.
My concrete use case : I have momentJS objects inside deep data to watch. But angular.equals doesn't work well with momentJS. For equality checking on momentJS object, moment#isSame must be used instead. Using this new functional parameter, i could delegate equality to lodash#isEqual which is able to customize object equality.