You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off, great library, it's easily the best of it's kind and makes working with REST APIs so much easier.
I've noticed that changes on properties that are objects aren't being picked up by the previous() method and consequently the hasChanges() method.
For example I have a user model where the data is:
{name: {first: 'Name'}, email: 'test@fake.com'}
If I change the email property, the functions behave correctly, however if I change name.first, hasChanges() returns false, and previous() returns the modified document.
The bug seems to be caused in the inject method, as the references to the original objects are being saved in the previous attributes. Using angular.copy() to save the previousAttributes appears to do the trick.
The diffObjectFromOldObject method then needs updating to detect changes in objects. Changing:
if(newValue!==oldObject[prop]){
to
if(!angular.equals(newValue,oldObject[prop])){
seems to do the trick.
The text was updated successfully, but these errors were encountered:
First off, great library, it's easily the best of it's kind and makes working with REST APIs so much easier.
I've noticed that changes on properties that are objects aren't being picked up by the previous() method and consequently the hasChanges() method.
For example I have a user model where the data is:
{name: {first: 'Name'}, email: 'test@fake.com'}
If I change the email property, the functions behave correctly, however if I change name.first, hasChanges() returns false, and previous() returns the modified document.
The bug seems to be caused in the inject method, as the references to the original objects are being saved in the previous attributes. Using angular.copy() to save the previousAttributes appears to do the trick.
The diffObjectFromOldObject method then needs updating to detect changes in objects. Changing:
to
seems to do the trick.
The text was updated successfully, but these errors were encountered: