AngularJs Forms
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> </head> <body> <div ng-app="myApp" ng-controller="myController"> <form novalidate> Name:<br> <input type="text" ng-model="user.name"><br> Email:<br> <input type="email" ng-model="user.email" > <br> <button ng-click="reset()">Reset</button> </form> <div>form = {{user }}</div> <div>master = {{master}}</div> </div> <script> var app = angular.module('myApp', []); app.controller('myController', function($scope) { $scope.master = {name:"Tani",email:"tani@ymaill.com"}; $scope.update = function(user){ $scope.master = angular.copy(user); } $scope.reset = function() { $scope.user = angular.copy($scope.master); }; $scope.reset(); }); </script> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script> </head> <body> <div ng-app="myApp" ng-controller="myController"> <form novalidate> Name:<br> <input type="text" ng-model="user.name"><br> Email:<br> <input type="email" ng-model="user.email" > <br> <button ng-click="reset()">Reset</button> </form> <div>form = {{user }}</div> <div>master = {{master}}</div> </div> <script> var app = angular.module('myApp', []); app.controller('myController', function($scope) { $scope.master = {name:"Tani",email:"tani@ymaill.com"}; $scope.update = function(user){ $scope.master = angular.copy(user); } $scope.reset = function() { $scope.user = angular.copy($scope.master); }; $scope.reset(); }); </script> </body> </html>
Copyrights@tutorialsplane.com