I can't understand why it's always shows NOT equal in code :
我无法理解为什么它总是在代码中显示不相等:
if(JSON.stringify(data.content.items) != JSON.stringify(updatedItems)) {
console.log('update');
updatedItems = data.content.items; // updatedItems -global variable
}
I receive array of objects and check every second if it's equal or not.
我接收对象数组,并检查每一秒是否相等。
1 个解决方案
#1
1
Use angular.fromJson(json)
instead. It will strip the $$hashKey
, that's making it not equal
请改用angular.fromJson(json)。它将剥离$$ hashKey,这使得它不相等
#1
1
Use angular.fromJson(json)
instead. It will strip the $$hashKey
, that's making it not equal
请改用angular.fromJson(json)。它将剥离$$ hashKey,这使得它不相等