Q:

angularJS target specific json node

Im working with a webservice and the returning JSON brings back some meta data that I use to define the layout of forms.
However, the JSON is continually evolving by the developers so currently where I target:
ng-repeat="cat in metaData[1].AcceptedValues"

To draw all the form structure...
Means that at some stage metaData Array element 1 may no longer hold the structure for this current form, it may be 2, 3 etc. JSON developer said he has now added additional data to identify each of the nodes under the value NAME
Under array element 1 I can now see Name : "ProductData" - and similarly under the other nodes different unique identifiers for Name
So basically I need to know how I can adjust my condition above to search for the metaData array element that contains the value Name = "ProductData" (or the value for the form I am rendering) and then any changes in array position is irrelevant.
Thanks

A:

You can create a method to find the specified object:
$scope.getProductData = function() {
    angular.forEach($scopem.metaData, function(item){
        if(item.Name === "ProductData"){
            return item.AcceptedValues;
        }
    });

    return [];
};

Then use it in your markup:
ng-repeat="cat in getProductData()"

