我有一個下拉在我angular.js web應用程序,如:排序不工作的下拉菜單
<select ng-model="script"
ng-options="s as s[1].shortDescription for s in objs | orderBy:'toString()'"
ng-change="updateParam()">
</select>
其中數組中的對象是
["test1", {shortDescription: "first test", longDescription: "AAAAAAAA"}]
我想shortDescription
排序類型每個條目的屬性。問題在於排序不起作用。
UPDATE1
的樣本數據
["test1", {shortDescription: "first test", longDescription: "AAAAAAAA"}]
["test2", {shortDescription: "2nd test", longDescription: "BBBB"}]
["test3", {shortDescription: "3rd test", longDescription: "CCCC"}]
ng選項中的數組索引看起來很可疑。 OrderBy後面應該跟着屬性名稱。 –