【发布时间】:2020-08-01 23:18:10
【问题描述】:
我有一个包含多个 mat-chips 的 mat-chip-list。但是当我点击 mat-chip 时,它们不会触发 valueChanges 事件,而其他控件触发的 valueChanges 事件也没有选择筹码的值。
这是代码。
<mat-chip-list aria-label="{{question.key}} selection" [selectable]=true>
<ng-container *ngFor="let opt of question.options">
<ng-container [ngSwitch]="opt.value">
<ng-container *ngSwitchCase="'No'">
<mat-basic-chip class="mat-basic-chip-no" [value]="opt.key" #lbl="matChip"
(click)="chipControlOnSelect(question.key,opt.key,fi,fgi, lbl)">
{{opt.value}}</mat-basic-chip>
</ng-container>
<ng-container *ngSwitchDefault>
<mat-basic-chip [value]="opt.key" #lbl="matChip"
(click)="chipControlOnSelect(question.key,opt.key,fi,fgi, lbl)">
{{opt.value}}</mat-basic-chip>
</ng-container>
</ng-container>
</ng-container>
</mat-chip-list>
【问题讨论】:
-
你有没有试过像这样[(ngModel)] = ''modelname"
-
应该提到,这些控件都是模板形式的。