2017-04-06 73 views
1

我們有一個內部系統,因爲我們不再與開發人員保持聯繫,我被要求更改其中一個下拉框以按字母順序排序。在排序角度下拉框時遇到問題

了一下頭刮傷我已經找到的代碼行(使用HTML &角)後:

<select class="form-control max-width-40" title="Vehicle" ng-model="day.plant" ng-options="plant.displayName() for plant in ctrl.plants | filter : {isVehicle: true} " ng-change="ctrl.plantOnChange(day)" ng-disabled="!day.isEditable || ctrl.isViewMode()"></select>

做一些研究之後,我認爲這將是如添加容易通過到EG行的順序:

<select class="form-control max-width-40" title="Vehicle" ng-model="day.plant" ng-options="plant.displayName() for plant in ctrl.plants | orderBy : plant.displayName | filter : {isVehicle: true} " ng-change="ctrl.plantOnChange(day)" ng-disabled="!day.isEditable || ctrl.isViewMode()"></select>

也試過:

<select class="form-control max-width-40" title="Vehicle" ng-model="day.plant" ng-options="plant.displayName() for plant in ctrl.plants | orderBy : 'toString()' | filter : {isVehicle: true} " ng-change="ctrl.plantOnChange(day)" ng-disabled="!day.isEditable || ctrl.isViewMode()"></select>

,但沒有任何運氣。 請問有人能指出我哪裏會出錯嗎? 我對這個領域知之甚少,所以會感激一些幫助。

謝謝你

+0

您可以創建一個小提琴讓我們有一個更好的圖片嗎? –

回答

1

你需要做一個小的改變。

<select class="form-control max-width-40" title="Vehicle" ng-model="day.plant" ng-options="plant.displayName() for plant in ctrl.plants | orderBy : 'displayName()' " ng-change="ctrl.plantOnChange(day)" ng-disabled="!day.isEditable || ctrl.isViewMode()"></select> 
+0

謝謝!你是對的! –