简体   繁体   English

ng-options自定义排序角度选择菜单,用于特定值

[英]ng-options custom sort angular select menu for particular value

<select name="region" id="region" ng-options="id as name for (id, name) in regions[entry.country]" ng-model="entry.region"  class="form-control select-styled" required></select>

I wanna use some kind of filter or custom sort to sort regions if entry.region is equal to Japnese. 如果entry.region等于Japnese,我想使用某种过滤器或自定义排序对区域进行排序。 Currently options are displayed by key, and i wanna sort them by value (japanese alphabet) ? 目前,选项是按键显示的,我想按值(日语字母)对它们进行排序? Any idea how to start? 任何想法如何开始?

You can create a custom filter to check what's the region and then apply sorting. 您可以创建一个自定义filter来检查区域是什么,然后应用排序。

Here's a plunker I've made for you. 这是我为你准备的一瓶油

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM