我在尝试使用 angularjs 引用模型时遇到了问题。我可以让其中一些参考,但其他一些不起作用。我已包含以下代码:
function DeleteCustomers($scope, func) {
$scope.delete = function() {
func.deleteCustomer($scope.customer);
}
}
function UpdateCustomers($scope, func) {
$scope.update = function() {
func.updateCustomer({ name: $scope.name2, telephone: $scope.telephone2,
email: $scope.email2, street: $scope.street2,
city: $scope.city2, zipcode: $scope.zipcode2 });
}
}
}
html是
<div ng-controller="UpdateCustomers">
<form class="test-angular-update">
<input type="text" ng-model="name2"><br>
<input type="text" ng-model="telephone2"><br>
<input type="text" ng-model="email2"><br>
<input type="text" ng-model="street2"><br>
<input type="text" ng-model="city2"><br>
<input type="text" ng-model="zipcode2"><br>
<button class="button" ng-click="update()">Update</button><br>
</form>
</div>
<br><br>
<div ng-controller="DeleteCustomers">
<form class="text-angular-delete">
Customer Name <input type="text" ng-model="customer"><br>
<button class="button" ng-click="delete()">Delete</button><br>
</form>
</div>
控制器无法引用 UpdateCustomers 和 DeleteCustomers 中的所有模型。任何帮助,将不胜感激。
谢谢!