【问题标题】:Angularjs validation are showing Error meassage even after validate即使在验证之后,Angularjs 验证也会显示错误消息
【发布时间】:2018-01-24 16:47:16
【问题描述】:

这就是为什么我的验证不起作用 我做错了什么请帮帮我

<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>

【问题讨论】:

    标签: angularjs angular-validation


    【解决方案1】:

    你的情况应该是

    ng-show="(f1.log_email.$error.required && f1.log_email.$dirty) ||(f1.log_email.$error.required && f1.log_email.$touched)"
    

    【讨论】:

    • 不应该是$touched而不是$touch吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-11-19
    • 2021-12-19
    • 1970-01-01
    • 1970-01-01
    • 2019-12-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多