0
我想在Angular JS中實現內聯編輯,但是下面的代碼不工作。Angular Js中的內聯編輯
<tr ng-repeat="employee in employees" ng-include="getTemplate(employee)">
<script type="text/ng-template" id="display">
<td>{{employee.Name}}</td>
<td ng-bind="employee.Age"></td>
<td ng-bind="employee.City"></td>
<td><a href="#" ng-click="EditEmployee(employee.EmpId)">Edit</a> </td>
<td><a href="#" ng-click="DeleteEmployee(employee.EmpId)">Delete</a> </td>
</script>
<script type="text/ng-template" id="edit">
<td><input type="hidden" ng-model="newemployee.EmpId" class="form-control input-sm"/></td>
<td><input type="text" ng-model="newemployee.Name" class="form-control input-sm"/></td>
<td><input type="text" ng-model="newemployee.Age" class="form-control input-sm"/></td>
<td><input type="text" ng-model="newemployee.City" class="form-control input-sm"/></td>
<td>
<button type="button" class="btn btn-primary" ng-click="updateEmployee(employee)">Save</button>
<button type="button" class="btn btn-danger" ng-click="reset()">Cancel</button>
</td>
</script>
</tr>
下面的代碼是沒有得到called-
$scope.employees = [];
$scope.getTemplate = function (employee) {
if (employee.empId === $scope.selected.empId){
return 'edit';
}
else return 'display';
};
我正在幫助從下面的鏈接 [鏈接](HTTP:/ /www.c-sharpcorner.com/UploadFile/shubham0987/creating-simple-inline-editing-with-angularjs/) –