<form name="form">
<label for="input">name</label>
<input name="input"></input>
<span id="sp1">name is required</span>
<span id="sp2">max length is 10</span>
</form>
How to control #sp1 to hide when not clicked, the format is correct to hide
sp2 will only be displayed if it exceeds the length
怪我咯2017-05-15 17:09:56
<form name="form">
<label for="input">姓名</label>
<input name="input" ng-maxlength="10" required></input>
<span id="sp1" ng-show="!form.input.$pristine">name is required</span>
<span id="sp2" ng-show="form.input.$invalid">max length is 10</span>
</form>
Anguarljs form validation reference document:
http://www.cnblogs.com/rohelm...