AngularJs Reset Form Fields
home
Run
screen_rotation
fullscreen
cloud_download
<!DOCTYPE html> <html lang="en"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script> <script> var myApp = angular.module("myApp", []); myApp.controller("myController", function($scope) { $scope.resetForm = function() { $scope.email = ''; $scope.password = ''; }; }); </script> </head> <body> <div ng-app="myApp"> <div ng-controller="myController"> <form action=""> <input type="text" name="email" ng-model="email"><br> <input type="password" name="password" ng-model="password"><br> <input type="button" value="Reset" ng-click="resetForm()"> <input type="submit" value="Submit" > <br> </form> </div> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script> <script> var myApp = angular.module("myApp", []); myApp.controller("myController", function($scope) { $scope.resetForm = function() { $scope.email = ''; $scope.password = ''; }; }); </script> </head> <body> <div ng-app="myApp"> <div ng-controller="myController"> <form action=""> <input type="text" name="email" ng-model="email"><br> <input type="password" name="password" ng-model="password"><br> <input type="button" value="Reset" ng-click="resetForm()"> <input type="submit" value="Submit" > <br> </form> </div> </body> </html>
Copyrights@tutorialsplane.com