This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
moment.js and scope.$watch when objectEquality is true #4996
Closed
Description
Hi,
I have a object that have a moment.js property like this:
obj = { date: moment(), status: 'ok' }
so if i watch this object with objectEquality like this:
scope.$watch('obj', ..., true);
i get this errors:
Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
To fix this i need to override angular.equals function to compare momentjs objects correctly.
function equals(o1, o2) {
/* patch for moment */
if (moment.isMoment(o1) && o1.toString() === o2.toString()) return true;
...
}
What is the best way to do this?
thanks.
Metadata
Metadata
Assignees
Labels
No labels