Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 当显示其他错误消息时,是否有可能隐藏错误消息?_Html_Angularjs - Fatal编程技术网

Html 当显示其他错误消息时,是否有可能隐藏错误消息?

Html 当显示其他错误消息时,是否有可能隐藏错误消息?,html,angularjs,Html,Angularjs,在这段代码中,如果我用空格键入少于6个字符,它会显示两个密码都应该至少有6个字符不允许空白 我不想同时显示两条错误消息,应该只显示一条错误消息 如果两个条件都满足,您需要决定显示哪一个 <form name="form"> <input type="password" placeholder="Password" ng-model="password" name="password" minlength="6" maxlength="15" ng-pattern=

在这段代码中,如果我用空格键入少于6个字符,它会显示两个密码都应该至少有6个字符不允许空白


我不想同时显示两条错误消息,应该只显示一条错误消息

如果两个条件都满足,您需要决定显示哪一个

 <form name="form">
     <input type="password" placeholder="Password" ng-model="password" name="password" minlength="6"  maxlength="15" ng-pattern="/^\S*$/" required>
     <span ng-show="form.password.$dirty && form.password.$invalid">
       <span ng-show="form.password.$error.required">Password is required.</span>
       <span ng-show="form.password.$error.minlength">Password should have atleast 6 characters.</span>
       <span ng-show="form.password.$error.pattern">White Space not allowed.</span>
     </span>
 </form>
如果你有第三个

<span ng-show="form.password.$error.minlength">Password should have atleast 6 characters.</span>
<span ng-show="form.password.$error.pattern && !form.password.$error.minlength">White Space not allowed.</span>
<span ng-show="form.password.$error.patternQ 
    && !form.password.$error.pattern 
    && !form.password.$error.minlength">Question mark not allowed.</span>