首页 > 代码库 > angularJs非空校验requied

angularJs非空校验requied

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="https://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="">
<form action="demo-form.php">
<textarea name="comment" required></textarea>
<input type="submit">
</form>

<!--上下两种方案效果一样。加不加ng-disabled="form1.$invalid"目前看来是一样的-->

<form action="demo-form.php" name="form1">
<textarea name="comment" required></textarea>
<input type="submit" ng-disabled="form1.$invalid">
</form>
</body>
</html>

angularJs非空校验requied