I have a ng-repeat, and in the drop down there are the following values.
Up to 6 months
From 13 to 24 months
Higher than 24 months
From 6 to 12 months
and I need to sort the values like the following
//following is the expected output
// Up to 6 months
//From 6 to 12 months
//From 13 to 24 months
//Higher than 24 months
$scope.items = [{name: 'Up to 6 months', id: 30 },{ name: 'From 13 to 24 months', id: 27 },{ name: 'Higher than 24 months', id: 50 },{ name: 'From 6 to 12 months', id: 50 }];
Your name field is not formatted text you cannot do order by on name, add one field like follows which will fill the field value with sorted criteria. An example sort function is given here:
Your data then will be like follows:
Use the following: