0

Here I have an array with many objects. In that I have a field as "id". I want only the id which has a value as null. How to pick it?

$scope.hierarchyList = response.data;

So how to pluck the value?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Vignesh
  • 1
  • 4

1 Answers1

0

it's quite complicate to answer if there's no way to know the structure of response.data. One way to do it (in case I understood) would be to:

var resultObj;
$scope.hierarchyList.forEach(function(hierarchy){
    if(hierarchy.id === undefined){
        resultObj = hierarchy; 
    }
})

please let me know if this is not the case or the question you're asking.