angular-local-storage
angular-local-storage copied to clipboard
Bind not watching deep with key like 'some.inner'
trafficstars
Hello,
The bind function is not watching deep with key like some.inner because angular.isObject always returns false with call:
isObject(scope[key])
The correct is object test must be:
isObject($parse(key)(scope))
Possible related issues: #322
Best regards, Bernardo Baumblatt.
Anyone who uses this feature have any thoughts?
Hello Gregory,
Are you asking for a solution or an opinion? Well, I think that is the first option because of bug label.
In this case, my fault, I was not clear enough. Let me try again..
Actual Code:
var bindToScope = function(scope, key, def, lsKey, type) {
........
return scope.$watch(key, function(newVal) {
addToLocalStorage(lsKey, newVal, type);
}, isObject(scope[key]));
Fixed Code:
var bindToScope = function(scope, key, def, lsKey, type) {
........
return scope.$watch(key, function(newVal) {
addToLocalStorage(lsKey, newVal, type);
}, isObject($parse(key)(scope)));
So, and the fix goes to ... line 466!
Best regards, Bernardo Baumblatt