-
Notifications
You must be signed in to change notification settings - Fork 86
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
does bind() a two way binding? #129
Comments
Yeah, I imagine people would expect it to work like that. A kind of "three-way" binding where changes in the scope update the DB and also update any other scope properties that are bound to the same key. Just took a quick peek at the implementation (I didn't write it...) and it might take a little bit of work to accomplish, but seems like a good candidate for the next major version. I'd argue that this is a breaking change since people might be depending on the current behavior. Maybe we can make this an opt-in feature. Stay tuned, and thanks for bringing this up! |
How it can be done with the current relase? |
@imwhocodes angular.module('yourModule', ['LocalForageModule'])
.config(['$localForageProvider', function($localForageProvider){
$localForageProvider.setNotify(true, true); // itemSet, itemRemove
}]); And then in your controller, you could listen for changes like: $scope.$on('LocalForageModule.setItem', function onSetItem(item) {
// item === {key: key, newvalue: value, driver: localforage.driver};
$scope.key = item.value;
}); Having said that, I would recommend against using |
|
If I bind to the same key in different controllers and one controller modify the object, this
modification is not reflected in the other controller right?
Wouldn't it be nice to have it that way.?
The text was updated successfully, but these errors were encountered: