Alternative Of Angularjs Two Function (parsley & Reset)
I am using below two function to reset error messages and reset all form fields value. $('#modal_form').parsley().reset();//It only reset error messages not form fields values $('#
Solution 1:
try like this.
var app = angular.module("testApp", []);
app.controller('testCtrl', function($scope){
$scope.data = {name:"",age:""};
$scope.reset = function(){
$scope.data = {};
}
});
<scriptsrc="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script><divng-app="testApp"ng-controller="testCtrl"><div ><formname="form"><inputtype="text"name="name"ng-model = "data.name"required><inputtype="text"name="age"ng-model = "data.age"required><inputtype="button"value="reset"ng-click="reset()"></form></div></div>
Post a Comment for "Alternative Of Angularjs Two Function (parsley & Reset)"