$scope.login = function () {
var userLoginData = JSON.parse(localStorage.getItem('userData'));
userName = (userLoginData.Name)
console.log(userLoginData);
}
This information is stored in my browser's local storage
[{"Name":"Admin","EmailId":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="29484d444047694e44484045074a4644">[email protected]</a>","password":"Admin","PhoneNo":"9765432108"},{"Name":"testuser2","EmailId":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="592d3c2a2d2c2a3c2b6b193e34383035773a3634">[email protected]</a>","password":"testing","PhoneNo":9871324560},{"Name":"test11","EmailId":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bfcbdacccb8e8e8effd8d2ded6d391dcd0d2">[email protected]</a>","password":"test","PhoneNo":9632196321}]
The console output shows,
0: Object { "Name": "Admin", EmailId: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="debfbab3b7b09eb9b3bfb7b2f0bdb1b3">[email protected]</a>", password: "Admin", … }
I would like to store the name and password fields in separate variables