I'm using Kelp404 for validation. After I submit the form through a HTTP post, I'm trying to reset the form.
// values set at initialization
_this.originalForm = {};
_this.formData = angular.copy(_this.originalForm);
// below code run in .then callback of http post
$scope.addCustomerForm.$setPristine();
$scope.addCustomerForm.$setUntouched();
_this.formData = angular.copy(_this.originalForm);
Now, the form is pristine and untouched with all the input variables cleared. But, the inputs are having the ng-invalid class set, which displays the error messages on the UI. I tried to set the validity also for them, but didn't help.
The code $validator.reset($scope, 'scope.formData'); is also not working
EDIT: The steps outlined in the linked question/answer do not solve the issue here
$validator.reset()working but it shows validation errors after I nullify the model. I've fixed it by calling the$validator.reset()in atimeoutblock after I nullify the model.