I have an array stored locally and I need to retrieve the "name" ID from all of them. How can I achieve this using AngularJS or JavaScript?
[{"email":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="85cfeaedebc5e4abe6eae8">[email protected]</a>","pass":"Doe","name":"John" },
{"email":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0d4c63636c4d6c236e6260">[email protected]</a>","pass":"Smith","name":"Smith"},
{"email":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="80d0e5f4e5f2c0e1aee3efed">[email protected]</a>","pass":"Jones","name":"Jones"}]
var app = angular.module('app',['ngStorage']);
app.controller('ctrl',function($scope){
$scope.complete=function(){
debugger
localStorage["data"] = localStorage.getItem('person');
$scope.obj = JSON.parse(localStorage["data"]);
console.log($scope.obj['0'].name);
$( "#tags" ).autocomplete({
source: $scope.obj['0'].name
});
}
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>