默认情况下,使用无功形式的3下拉菜单(角度6),它将显示数据对下拉菜单值的依赖性

时间:2019-01-24 06:26:25

标签: html angular

在角度6项目中,我有3个下拉菜单,彼此依赖。默认情况下,必须选择这些值并提交,然后它将显示数据。

我有下拉菜单的默认值。单击提交按钮,它将显示数据,更改下拉值后,提交也将起作用。

<form [formGroup] = "addTestFilter" (ngSubmit)="getTestsBysubject()">
   <select id="selectBoard" formControlName="board" name="selectBoard" class="form-control" 
     (change) = "getGradeByBoard(selectBoard)" required [(ngModel)]="selectBoard">
      <option *ngFor="let board of boards" [value]="board._id">
         {{board.boardName}}
      </option>                          
   </select>
  <select id="selectGrade" formControlName="grade" name="selectGrade" class="form-control" 
     (change) = "getGradeBySubject(selectGrade)" required [(ngModel)]="selectGrade">
     <option *ngFor="let grade of grades" [value]="grade._id">
        {{grade.grade}}
     </option>                          
 </select>
 <select id="select3" formControlName="subject" name="selectSubject" class="form-control" 
      required [(ngModel)]="selectSbject">
     <option *ngFor="let sub of subjects" [value]="sub._id">
        {{sub.subjectName}}
     </option>                          
 </select>
 <button type="submit" class="btn btn-success mr-1 fa fa-search"></button>
</form>

默认情况下,我必须不单击提交按钮来获取数据

0 个答案:

没有答案