Since the data that needs to be displayed in the same selection is in different objects, it is necessary to first prepare for the output.
It is necessary to regroup the original array so that the field name matches the list of values that can be passed to the select.
You can group it like this:
$scope.result = $scope.people.reduce(function(acc,people){ return Object.keys(people).reduce(function(acc,field){ if(!acc[field])acc[field] = []; acc[field].push(people[field]); return acc; },acc); },{});
In this case, the values of the fields can be repeated, since uniqueness is not checked. to save only unique values instead of an array, you can add them to an object; object keys are unique, for example:
$scope.result = $scope.people.reduce(function(acc,people){ return Object.keys(people).reduce(function(acc,field){ if(!acc[field])acc[field] = {}; acc[field][people[field]]=people[field]; return acc; },acc); },{});
Now you can proceed to the conclusion:
<th data-ng-repeat="(field,values) in result"> {{field}} <select data-ng-options="value for value in values" data-ng-model="selected[field]"></select> </th>
Working example:
angular.module('app', []) .controller('ctrl', function($scope) { var data = [{ "Name": "Вася", "FamilyName": "Петров" }, { "Name": "Вася", "FamilyName": "Сидоров" }, { "Name": "Ваня", "FamilyName": "Сидоров" }, { "Name": "Ваня", "FamilyName": "Петров" }]; $scope.selected = {}; $scope.selectedUniq = {}; $scope.result = data.reduce(function(acc, people) { return Object.keys(people).reduce(function(acc, field) { if (!acc[field]) acc[field] = []; acc[field].push(people[field]); return acc; }, acc); }, {}); $scope.resultUniq = data.reduce(function(acc, people) { return Object.keys(people).reduce(function(acc, field) { if (!acc[field]) acc[field] = {}; acc[field][people[field]] = people[field]; return acc; }, acc); }, {}); });
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.js"></script> <div ng-app="app" ng-controller="ctrl"> <table> <tr> <th>Не униакальные</th> <th data-ng-repeat="(field,values) in result"> {{field}} <select data-ng-options="value for value in values" data-ng-model="selected[field]"></select> </th> </tr> <tr> <th>Униакальные</th> <th data-ng-repeat="(field,values) in resultUniq"> {{field}} <select data-ng-options="value for value in values" data-ng-model="selectedUniq[field]"></select> </th> </tr> </table> <pre>{{selected|json}}</pre> <pre>{{selectedUniq|json}}</pre> </div>