I am not able to order a key value pair with respect to value
in alphabetical order.
The sample which I am using is,
"week_days_short":[
{"key":"1","value":"Mon"},
{"key":"2","value":"Tue"},
{"key":"4","value":"Thu"},
{"key":"3","value":"Wed"},
{"key":"5","value":"Fri"},
{"key":"6","value":"Sat"},
{"key":"7","value":"Sun"}
]
I have used the following code,
ng-options="key as value for (key, value) in
properties.week_days_short |
orderBy:'value' track by value"
But the sorting not happening. Any suggestions?
As orderBy in HTML won't work on Object and week_days_short is array. So sorting on controller fixed my issue.
Object.values($scope.properties.week_days_short).sort()