everything is working fine, but with an anomaly of 1 month. I want to show months in descending order,
ng-options="i as payrollRule.prd_date_display for (i,payrollRule) in payrollRules | orderBy:'-time'"
with JSON http://jsoneditoronline.org/?id=5180c8005b1072418925a0f01968bdffenter link description here
but as you see in img, only 01 Apr 2014 is coming at 2nd position instead of last. Any suggestion?
This is how you should use your HTML syntax:
<select ng-model="selected" ng-options="i as i.prd_date_display for i in payrollRules | orderBy:'-time'"></select>
The i is the object that will be in your selected variable, your i
variable is what you want to iterate over, hence the for i in payrollRules
. And then you display the property you want with as i.prd_date_display
.
However, this still result in an extra empty option since you have that empty object. You might want to filter it out.