HTML :
<form name="ContactForm" novalidate >
<div class="list">
<label class="item item-input">
<input type="text" placeholder="First Name" ng-model="contact.firstName" name="uFirstName" required="" autocomplete="off"/>
</label>
<br>
<div ng-show="ContactForm.$submitted || ContactForm.uFirstName.$touched" ng-hide="hidespan">
<span class="error" ng-show="ContactForm.uFirstName.$error.required">Tell us your First Name.</span>
<span class="error" ng-show="ContactForm.uFirstName.$error.text">This is not a valid First Name.</span>
</div>
</div>
<button class="button button-block button-assertive" ng-click="ContactForm.$valid && contactReq(contact)">
Submit
</button>
</form>
JS
var defaultForm = {
firstName : "",
lastName : "",
email : "",
message : ""
}
$scope.contact = angular.copy(defaultForm);
$scope.contactReq = function(contact){
$scope.ContactForm.$setPristine();
$scope.contact = angular.copy(defaultForm);
console.log('empty');
}
I am using AngularJS v1.4.3 for phonegap development. I want to reset the form after clicking the submit button. But when i am doing set Pristine i am getting the following error: "ERROR: Error: undefined is not an object (evaluating '$scope.ContactForm.$setPristine')" I tried many links related same but nothing is working for me.
Any help is highly appreciated.