Hi I am developing web application in angularjs. I am trying to query array in angularjs. Below is my code snippet.
var angulararray = [];
bindleaselistings.bindleaselistingsmethod().then(function(response) {
angular.forEach(response.data.data.LeaseList, function(value, key) {
angulararray.push(value);
});
}, function(error) {});
console.log(angulararray);
debugger;
var found = $filter('filter')(angulararray, {
id: accountnumber
}, true);
if (found.length) {
$scope.selected = JSON.stringify(found[0]);
} else {
$scope.selected = 'Not found';
}
console.log displays required array. I have attached screenshot.
When i debug the var found = $filter('filter')(angulararray, { id: accountnumber }, true);
I can see angulararray is empty. May I know am I doing anything wrong in above code? Any help would be appreciated. Thank you