这是我的代码示例
<select ng-model="selectedProdTeam"
ng-options="team for team in prodTeams | orderBy"
ng-change="getRolesBasedOnSelectedTeamProd()">
<option value="">Select Teams</option>
</select>
JS
$scope.getRolesBasedOnSelectedTeamProd = function(){
if($scope.selectedProdTeam != null || $scope.selectedProdTeam !=undefined){
$scope.prodRoles = $scope.prodResp.$scope.selectedProdTeam;
}
}
答案 0 :(得分:0)
应该是,
fflush(stdin)
修改强>:
您的orderBy过滤器应该使用参数或删除过滤器。
<select ng-model="selectedProdTeam" ng-options="team for team in prodTeams | orderBy" ng-change="getRolesBasedOnSelectedTeamProd()">
<option value="">Select Teams</option>
</select>
<强> ex | orderBy:'name'"
强>
DEMO
angular.module("myApp", [])
.controller("myCtrl", function ($scope) {
$scope.prodTeams = [
{ 'name':'Chelsea',
'id':1
},
{ 'name':'UK',
'id':2
}
];
$scope.getRolesBasedOnSelectedTeamProd = function(){
alert('fired');
}
});