angularjs简单表单校验
2016-10-25 09:58
363 查看
<!DOCTYPE html> <html ng-app="app"> <head> <meta charset="utf-8"> <title>EE</title> <script type="text/javascript" src="angular.min.js"></script> <style type="text/css"> body { font-size: 12px; } input { padding: 3px; } </style> </head> <body> <form name="temp_form" ng-submit="save()" ng-controller="c14"> <div> <input type="text" name="t_name" ng-model="name" required> <span ng-show="temp_form.t_name.$error.required"> 姓名不能为空! </span> </div> <div> <input type="email" name="t_email" ng-model="email" required> <span ng-show="temp_form.t_email.$error.required"> 邮箱不能为空 </span> <span ng-show="temp_form.t_email.$error.email"> 邮箱格式不正确 </span> </div> <input type="submit" ng-disabled="temp_form.$invalid" value="提交"> </form> <script type="text/javascript"> var app = angular.module("app", []); app.controller("c14", ['$scope', function($scope) { $scope.name = "raid"; $scope.email = "222222"; $scope.save = function() { console.log("提交成功"); } }]) </script> </body> </html>
相关文章推荐
- javascript_dom简单表单校验
- 简单的表单校验例子
- AngularJs实现简单表格,表单
- AngularJs表单校验功能实例代码
- angularJs表单校验
- 《struts---利用struts的标签,实现简单的表单提交及校验》
- 简单表单校验
- AngularJS中的表单简单入门
- angularJs表单校验(超级详细!!!)
- Angularjs使用指令做表单校验的方法
- JavaWeb -- Struts2,对比, 简单表单提交,校验,防重复提交, 文件上传
- AngularJs轻松入门(六)表单校验
- AngularJs轻松入门(六)表单校验
- angularjs 表单校验
- 注册时的表单提交与简单的前台校验
- 一步一步实现一个简单的表单校验框架一
- Angularjs使用指令做表单校验
- JavaWeb -- Struts2,对比, 简单表单提交,校验,防重复提交, 文件上传
- AngularJS入门教程之表单校验用法示例
- 简单的前端表单的校验