1 // Parse any JSON previously stored in allEntries
2 var existingEntries = JSON.parse(localStorage.getItem("store_owner_ad_contacts"));
3 if(existingEntries == null) existingEntries = [];
4
5 var adId = {
6 "id":$scope.adId
7 };
8 // Save allEntries back to local storage
9 existingEntries.push(adId);
10 localStorage.setItem("store_owner_ad_contacts", JSON.stringify(existingEntries));
11
12 var values = JSON.parse(localStorage.getItem("store_owner_ad_contacts"));
13 angular.forEach(values, function(value, key) {
14
15 // ^ This is coming as an object how can I get the key value?
16
17 if(value == adId){
18 //form has been submitted before
19 }else{
20 // showformVar = true
21
22 console.log(key + ': ' + value);
23 });
24