angular.js - angular表单格式提示
给我你的怀抱
给我你的怀抱 2017-05-15 17:07:56
0
1
540

<form name="form">
<label for="input">姓名</label>
<input name="input"></input>
<span id="sp1">name is required</span>
<span id="sp2">max length is 10</span>
</form>
如何控制#sp1在未点击时隐藏,格式正确隐藏
sp2只有超出长度才显示

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

Antworte allen(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表单验证的参考文档:
http://www.cnblogs.com/rohelm...

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage