I am trying to get a category dropdown list fetched from below JSON data. I have same category multiple times, For Ex: Computer
[
{
"title":"C Programming",
"category":"Computer"
},
{
"title":"International Tax",
"category":"Business"
},
{
"title":".net Programming",
"category":"Computer"
}
//more data...
]
AngularJS:
function showSubjects($scope, $http)
{
$http({method: 'POST', url: 'js/subjects.json'}).success(function(data)
{
$scope.items= data; // response data
});
}
HTML:
<div id="ng-app" ng-app ng-controller="showSubjects">
<select>
<option ng-repeat="subjects in items">{{subjects.category}}</option>
</select>
</div>
I want to display duplicate categories only once. Please give me some suggestions, how to acheive the required output. Thanks in advance.