php - 密码确认字段在 angularjs 中不起作用

标签 php angularjs

                                            <div class="form-group">
                                                <label class="control-label control-label-1">Password</label>
                                                <input type="password" placeholder="Password" name="password" class="form-control form-control-1" ng-model="Userdata.password" required="">

                                            </div>

                                        </div>

                                        <div class="col-xs-6">  

                                            <div class="form-group"> 
                                                <label class="control-label control-label-1">Retype Password</label>
                                                <input type="password" placeholder="Retype Password" name="password2" class="form-control form-control-1" ng-model="Userdata.password2" required="">
                                               <div ng-show="Userdata.password != Userdata.password2">Password mis match!</div>

                                            </div>  

                                        </div>   

密码和密码确认字段无法正常工作,在输入确认字段之前(即输入密码字段本身时)显示错误消息。 我怎样才能正确地编写代码。

最佳答案

在 ng-show 中添加 AND 条件,

<div ng-show="(Userdata.password && Userdata.password2 && (Userdata.password != Userdata.password2))">Password mis match!</div>

关于php - 密码确认字段在 angularjs 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39270145/

相关文章:

javascript - 具有实时数据的谷歌地图 API 标记

angularjs - 在AngularJS中使用 'ng-style'添加背景图片

javascript - AngularJS 可以在加载后编译由外部库附加的 HTML 吗?

javascript - 如何检测 $http/Restangular 中的 IHttpActionResult 状态代码?

html - 如果单击,则赋予 active 类直到单击另一个元素,然后赋予第二个元素 active 类并从第一个元素中删除 active 类

javascript - 链接打开但模态背景仍然存在

php SOAP 信封命名空间 <soap :Envelope and <SOAP-ENV:Envelope

php - 如何使用多个实体绑定(bind)设置 ElasticSearch 索引结构

php - 如何在 woocommerce 中以编程方式插入产品类型

php - 如何在不进行循环的情况下仅从查询中获得一个结果