I have Data Like
$scope.Fruits = [
{ name: "Sapota", rate: 100, Location: "Hyderabad" ,Type:"Fruits"},
{ name: "Pomogranate", rate: 70, Location: "Cumbum", Type: "Vegetables" },
{ name: "Apple", rate: 60, Location: "Hyderabad", Type: "Fruits" },
{ name: "Guvva", rate: 100, Location: "Guntur", Type: "Vegetables" },
{ name: "Grapes", rate: 100, Location: "Vizag", Type: "Fruits" },
{ name: "Pinapple", rate: 100, Location: "Vijayawada", Type: "Animals" }
];
Now i have to display data with type header and below that each of different items related to that type like below.
I tried with unique and filter combination but getting error.
<tbody ng-repeat="x in questions | unique:'Classification' track by $index">
<tr class="trsub-bg">
<td class="text-center">{{$index+1}}</td>
<td colspan="4"><strong>{{x.Classification}}</strong></td>
</tr>
<tr ng-repeat="question in questions | filter:x.Classification track by $index">
<td class="text-center">{{$parent.$index+1}}.{{$index+1}}</td>
<td>{{question.question}}</td>
<td>
</td>
<td><textarea class="form-control" rows="2" ng-model="question.comments"></textarea></td>
</tr>
</tbody>