Angularjs 即使在验证之后验证仍显示错误消息
Angularjs validation are showing Error meassage even after validate
我的验证不起作用的原因
我做错了什么请帮助我
<div ng-controller="LoginCtrls">
<form novalidate name="f1" ng-submit="SaveData(User)">
<div class="form-group">
<label>Email address:</label>
<input type="text" class="form-control" name="log_email" ng-model="User.Email" required>
<span ng-show="(f1.log_email.$error.required) && f1.log_email.$dirty) ||(f1.log_email.$touch)">Please Enter Your Email</span>
</div>
</form>
你的条件应该是
ng-show="(f1.log_email.$error.required && f1.log_email.$dirty) ||(f1.log_email.$error.required && f1.log_email.$touched)"
我的验证不起作用的原因 我做错了什么请帮助我
<div ng-controller="LoginCtrls">
<form novalidate name="f1" ng-submit="SaveData(User)">
<div class="form-group">
<label>Email address:</label>
<input type="text" class="form-control" name="log_email" ng-model="User.Email" required>
<span ng-show="(f1.log_email.$error.required) && f1.log_email.$dirty) ||(f1.log_email.$touch)">Please Enter Your Email</span>
</div>
</form>
你的条件应该是
ng-show="(f1.log_email.$error.required && f1.log_email.$dirty) ||(f1.log_email.$error.required && f1.log_email.$touched)"