Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.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_Angular_Types - Fatal编程技术网

Html 如何根据其他选择获取验证选择

Html 如何根据其他选择获取验证选择,html,angular,types,Html,Angular,Types,我有一份医生名单。每个医生都有自己的程序。如何将所选医生程序应用于程序选择 html 对于选择控件,选项值必须绑定到[ngValue]而不是值属性 下面是一个工作示例,演示如何绑定到医生数组,然后如何检索selectedProcedure的值 PS-我个人觉得使用它比创建表单控件更方便 <div class="form-group"> <label for="doctors">Doctor</label>

我有一份医生名单。每个医生都有自己的程序。如何将所选医生程序应用于程序选择

html


对于
选择
控件,选项值必须绑定到
[ngValue]
而不是
属性

下面是一个工作示例,演示如何绑定到
医生
数组,然后如何检索
selectedProcedure
的值

PS-我个人觉得使用它比创建
表单控件更方便

        <div class="form-group">
            <label for="doctors">Doctor</label>
            <select [formControl]="selectControl" class="form-control" id="doctors">
                <option value="doctor"*ngFor="let doctor of doctors">{{doctor.username}}</option>
              </select>
        </div>

        <div class="form-group">
            <label for="procedures">Select Procedure</label>
            <select *ngIf="selectControl.valid" class="form-control" id="procedures">
                <option *ngFor="let p of selectControl.value.procedures">{{p}</option>
              </select>
        </div>
selectControl: FormControl = new FormControl();