Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.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 angular-ng show在表单字段无效时不会删除ng hide类_Html_Angularjs_Validation_Ng Show - Fatal编程技术网

Html angular-ng show在表单字段无效时不会删除ng hide类

Html angular-ng show在表单字段无效时不会删除ng hide类,html,angularjs,validation,ng-show,Html,Angularjs,Validation,Ng Show,ng show在表单上有它的ng hide类,每当该字段变得无效时,它应该删除该类并显示错误消息,但由于某些原因,它不起作用 太久了! 太短了! 必修的 不是电子邮件 将您的表单name=“email form”更改为name=“emailForm”。按照以下步骤,您应该使用以下内容: <span ng-show="emailForm.email.$dirty && emailForm.email.$error.required">required</spa

ng show在表单上有它的ng hide类,每当该字段变得无效时,它应该删除该类并显示错误消息,但由于某些原因,它不起作用


太久了!
太短了!
必修的
不是电子邮件

将您的表单name=“email form”更改为name=“emailForm”。按照以下步骤,您应该使用以下内容:

<span ng-show="emailForm.email.$dirty && emailForm.email.$error.required">required</span>
<span ng-show="emailForm.email.$dirty && emailForm.email.$error.email">not an email</span>
必需
不是电子邮件

与其他两个相同。

$dirty
不是
dirty
就是这样!结合下面的答案:)非常感谢。