0
我有功能的角度JS,這就是重置HTML表單:
$scope.resetForm = function (formName)
{
$scope.formData = angular.copy(formEdit);
$scope.formName.$setPristine();
}
HTML看起來爲:
<form name="educAddForm" novalidate>
<div ng-click="resetForm(educAddForm)">Click</div>
點擊後,我得到錯誤:
TypeError: Cannot read property '$setPristine' of undefined
將'$ scope.formName。$ setPristine()'改爲'formName。$ setPristine()' – PSL