我有两个下拉列表:
private elementRef: ElementRef
<select
class="form-control same-group"
[(ngModel)]="selected"
(ngModelChange)="select($event)"
formControlName="age">
<option
*ngFor="let x of collection"
[value]="x">
{{x}}
</option>
</select>
<select
class="form-control same-group"
[(ngModel)]="selected2"
(ngModelChange)="select2($event)"
formControlName="age2">
<option
*ngFor="let x of collection2"
[value]="x">
{{x}}
</option>
</select>
我想选择所有的值到数组中的下拉列表与相同的组类追加如上所示。
所以,如果在第一个下拉列表中选择的值是“test”,而在第二个下拉列表中选择的值是“test”,我希望有[“test”,“test2”]。