title: localStorage get value using angular
body: <p>I looked at some examples, but can't seem to figure this out.  Basically I have a contact form in an ionic app that allows a user to contact a listing owner.  </p>
  
  <p>When they submit the form I want to store the ad id in local storage so they can't repeatability submit it over and over. </p>
  
  <p>I need to be able to store json array and then check the results. If the ad id is in session storage don't show the form else show it. </p>
  
  <p>I am currently doing this, which seems to store the ad ids in an array, but how do I loop through to check if an id exists?  I tried angular forEach, but results come as an object. </p>
  
  <pre><code>    // Parse any JSON previously stored in allEntries
    var existingEntries = JSON.parse(localStorage.getItem("store_owner_ad_contacts"));
    if(existingEntries == null) existingEntries = [];
  
    var adId = {
      "id":$scope.adId
    };
    // Save allEntries back to local storage
    existingEntries.push(adId);
    localStorage.setItem("store_owner_ad_contacts", JSON.stringify(existingEntries));
  
    var values = JSON.parse(localStorage.getItem("store_owner_ad_contacts"));
    angular.forEach(values, function(value, key) {
  
    // ^ This is coming as an object how can I get the key value?
  
     if(value == adId){
     //form has been submitted before
     }else{
     // showformVar = true 
  
      console.log(key + ': ' + value);
    });
  </code></pre>
  
  <p>My storage looks like this </p>
  
  <pre><code>      [{"id":"100033"},{"id":"100035"},{"id":"1000336"}]
  </code></pre>
  
  <p>How do I get id value?  (e.g 1000033) </p>