AngularJS ng-options按字母顺序排序

时间:2015-11-13 23:40:33

标签: angularjs sorting ng-options alphabetical

我有一组下拉选项,每个选项都有一个值列表。我试图让每个人的名字按字母顺序排序。以下是代码。

<div class="row">
  <div class="col-xs-12 col-sm-12 col-md-12">
    <div>
      <form class="form-horizontal">
        <div class='form-horizontal range-date'>
          <div class="input-daterange input-group text-center" id="datepicker">
            <input class="pull-right date-size" name="startDate" type="text" placeholder="Start" class="form-control ">
            <span class="input-group-addon">To</span>
            <input class="pull-left date-size" name="endDate" type="text" placeholder="End" class="form-control">
          </div>
        </div>
        <div id='query_messages' class='alert alert-danger'></div>
        <div ng-repeat="item_query in items_query">
          <div class="form-group">
            <label class="control-label col-lg-2 pad-o">
              <span ng-bind="Label{{item_query}}"></span>
            </label>
            <div class="col-lg-10" ng-if="item_query!=12">
              <select ng-model="queryParam[item_query]" ng-options="item.name for item in optionsParam{{item_query}} track by item.id | orderBy: 'item.name'"
                    ng-change="change(queryParam[item_query])"
                    ng-attr-id="query_select{{item_query}}" class="selectpicker class_id{{item_query}} "
                    multiple data-selected-text-format="count>0" title='Choose any of the following'
                    data-queue-watcher>
              </select>
            </div>
            <div class="col-lg-10" ng-if="item_query==12">
              <select ng-model="queryParam[item_query]" ng-options="item.name for item in optionsParam{{item_query}} track by item.id | orderBy: 'item.name'"
                    ng-change="change(queryParam[item_query])"
                    ng-attr-id="query_select{{item_query}}" class="selectpicker class_id{{item_query}} "
                    multiple data-selected-text-format="count>0" title='Choose one of the following'
                    data-queue-watcher>
              </select>
            </div>
          </div>
        </div>
      </form>
    </div>
  </div>
</div>

0 个答案:

没有答案