angular-local-storage icon indicating copy to clipboard operation
angular-local-storage copied to clipboard

localStorageService.bind with array

Open hezo opened this issue 9 years ago • 0 comments

binding array to localstorage is overriding stored array with defined array. localStorageService.bind($scope, 'selections', [{"name": "A", selected: true}, {"name": "B", selected: true }]);

selected values are always true on page refresh, values are succefully being stored in localstorage but value = extend(value, def);on line 401 overrides stored array with the defined one, adding simple array check fixes this for me

if(!Array.isArray(def))
 value = extend(value, def);

hezo avatar Apr 21 '16 11:04 hezo