angular.js - angular form formatting tips
给我你的怀抱
给我你的怀抱 2017-05-15 17:07:56
0
1
564

<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

给我你的怀抱
给我你的怀抱

reply all(1)
刘奇
<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...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template