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.

2

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.