【发布时间】:2021-08-22 06:22:54
【问题描述】:
所以,我有一个组合框,我希望每当我从组合框中选择某些内容时自动填充我的文本框。我的组合框被命名为飞机类型,它应该自动填充名为“电机数量和 MTOW”的文本框和名为“电机类型”的组合框。它们都来自一个 API,并且它们都相互关联。 这是我的组合框和文本框的代码:
<mat-form-field appearance="outline" class="width-4">
<mat-label>Aircraft Type (ICAO)</mat-label>
<mat-select formControlName="aircraftType" required>
<mat-option *ngFor="let item of aircraftTypes" [value]="item.value">
{{ item.label }}
</mat-option>
</mat-select> </mat-form-field
><br />
<mat-form-field appearance="outline" class="width-3">
<mat-label>Number of Motors</mat-label>
<input
maxlength="50"
matInput
formControlName="numberMotors"
placeholder="Number of Motors"
required
/>
</mat-form-field>
<mat-form-field appearance="outline" class="width-3">
<mat-label>Type of Motor</mat-label>
<mat-select formControlName="typeMotors" required>
<mat-option *ngFor="let item of motorTypes" [value]="item.value">
{{ item.label }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" class="width-3">
<mat-label>MTOW (kg)</mat-label>
<input
maxlength="50"
matInput
formControlName="mtow"
placeholder="MTOW"
required
/>
</mat-form-field>
【问题讨论】:
标签: angular input combobox textbox fill