Angularjs form reset

Viewed 55110

I have a reset function in angular to clear all the fields in a form. If I do something like:

<a href="#" ng-click="resetForm()">reset</a>

$scope.resetForm = function() {
  $scope.someForm = {};
}

Everything works fine. But I want to use this function for multiple forms on the site. If I pass the form object in like:

<a href="#" ng-click="resetForm(someForm)">reset</a>

$scope.resetForm = function(form) {
  $scope.form = {};
}

Then it won't work. Can someone explain to me why this would be happening?

3 Answers
Related