angularLocalStorage
angularLocalStorage copied to clipboard
Prevent ngRepeat duplicate error
if localstorage bound object is used in ngRepeat, then the object will be persisted to localstorage with $$hashkey, potentially causing the aforementioned error. this can either be addressed by using track by in the ngRepeat construct or adjusting the code in angularlocalstorage to strip the hashkey before set.
recommended change: var saver = $window.JSON.stringify(value, function(key, val) { if(key == '$$hashKey') { return undefined; } return val; });
@thombrg - I have created a new Plunker that uses ngRepeat, let me know if the following doesn't match what you are seeing.
http://plnkr.co/edit/PNLjDEaRKtpLgGZMJypk?p=preview