0
大家有這些JSON值NG-選項並不適用於SELECT語句添加新功能
[{"Employee":{"Empid":"EF00001","Fname":"Aruna","Lname":"Jayalath"}}]
但是,當我在執行這個功能我不能讓SELECT語句中的值角度控制器。
SriptController.js
$scope.addNew = function (records) {
EmployeeService.GetEmpDetails(function (res) {
$scope.empDetails = JSON.parse(res.data);
console.log("Here");
});
$scope.records.push({
'Empid': $scope.records.Empid,
'Role': $scope.records.Role,
'currAllo': $scope.records.currAllo,
'hours': $scope.records.hours,
'Fname': $scope.records.Fname
});
}
和HTML代碼:
<td>
<select class="form-control" id="selectemp" name="selectemp" ng-model="emp.Employee.Empid" ng-options="emp as emp.Employee.Fname for emp in empDetails track by emp.Employee.Empid">
<option></option>
</select>
</td>
當我點擊添加新的功能,它應該填補的選擇選項。我如何做到這一點。幫助將不勝感激。