如标题,现有一个表单,里面有一个div是由一个复选框来控制的,如果勾选,则显示出来这个div下的input元素,并且必填校验。如果没有勾选,则表单提交时无需校验隐藏元素。ng-if的话,显示出来的元素即使加了validator="[required]",显示出来后也是没有校验的。ng-hide的话,validator="[required]"隐藏掉的元素,它也会做必填校验。
补充:如果直接在input标签中写 required 这个属性,好像只有在IE下能达到想要的效果。
Your Answer
3 answers
Hot tools Tags
Hot Questions
How to send a POST request in Go?
2026-01-04 22:01:31
Replacing accented characters php
2026-01-04 21:43:20
custom listview adapter getView method being called multiple times, and in no coherent order
2026-01-04 21:22:09
Using RegEx to balance match parenthesis
2026-01-04 21:01:38
Asynchronous Requests with Python requests
2026-01-04 20:42:13
Popular tool
vc9-vc14 (32+64 bit) runtime library collection (link below)
Download the collection of runtime libraries required for phpStudy installation
VC9 32-bit
VC9 32-bit phpstudy integrated installation environment runtime library
PHP programmer toolbox full version
Programmer Toolbox v1.0 PHP Integrated Environment
VC11 32-bit
VC11 32-bit phpstudy integrated installation environment runtime library
SublimeText3 Chinese version
Chinese version, very easy to use
Hot Topics
Douyin level price list 1-75
20417
7
20417
7
wifi shows no ip assigned
13577
4
13577
4
Hot Article
How to set up price alerts so you don't miss key entry points?
2026-01-01
By DDD
Why do professional traders advise newbies to start with low leverage?
2026-01-01
By DDD
How to Fix a 'KERNEL_DATA_INPAGE_ERROR' on Windows?
2026-01-02
By 下次还敢
How to reverse a string in Python? (code examples)
2025-12-31
By 下次还敢






