I am using orderby filter to sort rate of my product.But it is not working properly.Please help me to find out the issue. Json :
productSize :: [{"prodsize":"DOUBLE","sizerate":"181.00"},{"prodsize":"FAMILY","sizerate":"316.00"},{"prodsize":"SOLO","sizerate":"79.00"}]
Code :
<div class="item" style="border: 0px; padding: 7px"
ng-repeat="size in productSize | orderBy:'sizerate'">
<div class="row">
<div class="col" style="margin-top: 20px">{{size.prodsize}}</div>
<div class="col" style="text-align: right">
Rs.{{size.sizerate}} <label class="checkbox" style="top: 16px"><input value="true"
name="size" type="radio" ng-model="sizeChecked" ng-change="addPropertiesToProduct('Size',size.prodsize,size.sizerate,sizeChecked)"></label>
</div>
</div>
</div>
The orderBy
filter is working. Your problem comes from the fact that the sizerate
properties are strings instead of numbers, therefore:
"181.00" < "316.00" < "79.00"
Correct your data structure to get the result you want.