After retrieving JSON data from an API, I store it in $scope.industry.
$scope.industry = [];
$http.get('/industrygroup?languageid=1')
.then(function (result) {
$scope.industry = result.data;
});
The JSON data stored in $scope.industry holds information about industries.
To populate my dropdown menu, I use ng-option and specify the values to display as:
ng-options="p.Name for p in industry[0].Occupations"
Currently, the dropdown shows occupation names. However, I want it to display industry names instead. Here is a snippet of the JSON data structure:
{
"Language":{
"Id":1,
"Name":"English"
},
"Occupations":[
],
"Id":2,
"Name":"Food and Beverage"
}
I aim to display the Name "Food and Beverage" in the dropdown menu. This JSON example represents one row returned by the API, and I wish to show all Names excluding the Language Name.