How I can store multiple objects into an array and then into local storage so that I can get all objects when required using a loop.
example objects:
var newMsg = {
sentDate: msgDate,
sentTime: msgTime,
msgTitle: "message title",
msgDesc: "message desc"
};
Currently I'm using https://github.com/grevory/angular-local-storage#configuration-example angularjs module but struggling to store and retrieve objects from an array.
I have tried the following code:
msgArray = [];
var savedMsgs = localStorageService.set("wimmtkey", newMsg);
msgArray.push(savedMsgs);
console.log(savedMsgs);
This outputs 'true' in the console but expecting to see the stored object. Please also advise to loop through the array to retrieve the objects. Thanks.