-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added in deep compare option for bind and documented bind feature #144
Conversation
It will be slower, but allows for binding an array objects. http://stackoverflow.com/a/14713978/1447621
Documented the newly added feature and the other arguments as well.
@kjlubick , Thanks. |
Added a test. Is that sufficient? |
@kjlubick would you please just merge these 4 commits into only one? thanks. |
Conflicts: README.md
Couldn't do it in one because of the two merge conflicts. |
Conflicts: README.md src/angular-local-storage.js
Ready to merge |
I think we should always use @kjlubick I think it's kinda messy to do something like that: |
5 args is a bit much, I agree. I didn't make it default because the angularjs docs warned of a performance hit - but if it's not doing what we want anyway than we don't have too much of a choice. |
@kjlubick , we can go this way: $scope.$watch(key, function(newVal) {
//...
}, isObject($scope[key])); so, if it's primitive value, we comparing for reference equality. so actually it really cheaper. |
I like it
|
First off, thanks for making a great localstorage module. I especially liked that it basically worked with everything, arrays and all, out of the box.
I had a complicated array structure that I wanted to store and as per http://stackoverflow.com/questions/14712089/how-to-deep-watch-an-array-in-angularjs
the advice was to use $watch instead of $watchCollection to deal with the deep comparision that I needed.
It's a relatively small change and I hope my documentation on bind is helpful to others as well.