angularJs学习7:表单form 发表于 2016-03-02 | 分类于 angulasJs | 什么是表单,一般是form 1234567891011121314151617181920212223242526<div ng-app="myApp" ng-controller="formCtrl"> <form novalidate> First Name:<br> <input type="text" ng-model="user.firstName"><br> Last Name:<br> <input type="text" ng-model="user.lastName"> <br><br> <button ng-click="reset()">恢复默认</button> </form> <p>form = {{user }}</p> <p>default = {{default}}</p></div><script>var app = angular.module('myApp', []);app.controller('formCtrl', function($scope) { $scope.default = {firstName:"John", lastName:"Doe"}; $scope.reset = function() { $scope.user = angular.copy($scope.default); }; $scope.reset();});</script></body></html>