title: Angularjs - How to store objects in an array and local storage
body: <p>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.</p>
  
  <p>example objects:</p>
  
  <pre><code>var newMsg = {
        sentDate: msgDate,
        sentTime: msgTime,
        msgTitle: "message title",
        msgDesc: "message desc"
      };
  </code></pre>
  
  <p>Currently I'm using <a href="https://github.com/grevory/angular-local-storage#configuration-example" rel="noreferrer">https://github.com/grevory/angular-local-storage#configuration-example</a> angularjs module but struggling to store and retrieve objects from an array. </p>
  
  <p>I have tried the following code:</p>
  
  <pre><code>msgArray = [];
  var savedMsgs = localStorageService.set("wimmtkey", newMsg);
  
      msgArray.push(savedMsgs); 
      console.log(savedMsgs);
  </code></pre>
  
  <p>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. </p>