0
我在我的项目中使用了angularJS select指令。如何更改select指令中弹出选项窗口中项目的顺序?
这里是例如:
模板:
<div ng-app>
<div ng-controller="Ctrl">
<select ng-model="selected" ng-options="f.name for f in friends "></select>
</div>
</div>
控制器:
function Ctrl($scope) {
$scope.friends =
[{name:'John', phone:'555-1212', age:0},
{name:'Mary', phone:'555-9876', age:0},
{name:'Mike', phone:'555-4321', age:0},
{name:'AllNames', phone:'5558-55', age:0},
{name:'Adam', phone:'555-5678', age:0},
{name:'Julie', phone:'555-8765', age:0}];
$scope.selected = $scope.friends[3];
}
这里工作fiddle。
The `friends` list is list that I get from database table and it ordered as list above.
当我点击选择指令,窗口的选择是与可selected.I需要做出AllNames项目将出现在选项窗口的列表顶部的所有选项的弹出窗口。
任何想法如何实现它?
我需要的唯一名字属性进行过滤。 – Michael