Skip to content

Prevent ngRepeat duplicate error #41

Open

Description

@thombrg

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;
});

Activity

  1. hppycoder commented on Jan 30, 2015

    @hppycoder
    Collaborator

    @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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions