javascript - How to sort dropdown in angularjs? -
i have try order dropdown using angularjs. but, sorting not working. please me. please check link: jsfiddle
html: html code here
<select ng-options="key value (key, value) in charitylist | orderby:'value'" ng-model="reportsearch.charityid"> <option value="">all charity</option> </select>
json array: json "key=>value" array using dropdown list
$scope.charitylist = { "1": "softweb charity", "2": "charity 1", "3": "charity update", "4": "engagement1 name", "6": "united way enagagement", "7": "indian noble charity" }
please check link: jsfiddle
what have object not array. , array defined chevrons.
charitylist = [ {"name": "softweb charity"}, {"name": "charity 1"}, {"name": "charity update"}, {"name": "engagement1 name"}, {"name": "united way enagagement"}, {"name": "indian noble charity"} ],
if can make way can sort orderby
ng-options="value.name value in charitylist | orderby:'name'"
Comments
Post a Comment