localstorage getitem angular

The solution for “localstorage getitem angular” can be found here. The following code will assist you in solving the problem.

// Parse any JSON previously stored in allEntries
var existingEntries = JSON.parse(localStorage.getItem(“store_owner_ad_contacts”));
if(existingEntries == null) existingEntries = [];

var adId = {
// Save allEntries back to local storage
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
// showformVar = true

console.log(key + ‘: ‘ + value);

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

inline scripts encapsulated in