Skip to content

Commit

Permalink
check if val is defined before overwriting
Browse files Browse the repository at this point in the history
  • Loading branch information
antham committed Aug 12, 2013
1 parent 8fdc829 commit d680faf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/localStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ angular.module('localStorage', ['ngCookies']).factory('$store', function ($parse
}
$parse(key).assign($scope, publicMethods.get(key));
$scope.$watch(key, function (val) {
publicMethods.set(key, val);
if (angular.isDefined(val)) {
publicMethods.set(key, val);
}
}, true);
return publicMethods.get(key);
},
Expand Down

0 comments on commit d680faf

Please sign in to comment.