0

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.

Serhiy
  • 1,893
  • 9
  • 30
  • 48

1 Answers1

1

Use angular.fromJson(json) instead. It will strip the $$hashKey, that's making it not equal

taguenizy
  • 2,140
  • 1
  • 8
  • 26