我正在尝试将值绑定到“编辑”按钮上的字段。以前一切都工作正常,但突然下拉(性别)控制没有约束力。这是代码 - HTML UI -
$scope.EditEmployee = function (EID) {
for (i in $scope.employees) {
if ($scope.employees[i].EmpId == EID) {
$scope.newemployee = {
EmpId: $scope.employees[i].EmpId,
Name: $scope.employees[i].Name,
Age: $scope.employees[i].Age,
Gender: $scope.employees[i].Gender,
City: $scope.employees[i].City
};
}
}
};
这是控制器将值绑定到控件 -
{{1}}
文本字段值正在绑定,但下拉列表显示空白
答案 0 :(得分:0)
答案 1 :(得分:0)
试试这个..
in dropdown use - ng-model="newemployee.Gender"
in option use - <option ng-model="newemployee.Gender">Male</option>
<option ng-model="newemployee.Gender">Female</option>