<!doctype html> <html ng-app="myapp"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="js/Angular.js"></script> <script> //控制器注册 var myapp=angular.module("myapp", []).controller("TestController", function($scope) { $scope.modelReset = function(){ $scope.firstName = "1111"; $scope.lastName = "lww"; $scope.email = "[email protected]"; } }); </script> </head> <body> $dirty:规定值已被改变<br/> $invalid:该值的状态是无效的<br/> $error:指出确切的错误<br/> $dirty 和 $invalid标志做验证的方式。使用novalidate表单声明禁止任何浏览器特定的验证<br/> ng-include:载入html的片段<br/> ng-view 标记只是简单地创建一个占位符,是一个相应的视图(HTML或ng-template视图)<br/> ng-template 指令是用来创建使用script标签的HTML视图。它包含一个用于由$routeProvider映射控制器视图“id”属性。<br/> <span>模型九</span><br/> <div ng-controller="TestController"> <input name="firstname" type="text" ng-model="firstName" required> <input name="lastname" type="text" ng-model="lastName" required> <input name="email" type="email" ng-model="email" required> <button ng-click="modelReset()">Reset</button> </div> </body> </html>
时间: 2024-10-06 20:47:59