切换到 Angular4,material 2 autoComplete onSelect() 不工作
Switched to Angular4, material 2 autoComplete onSelect() not working
刚刚切换到 Angular 4 和 material 2 autoComplete 的 md-option 上的 onSelect() 不再有效,但我找不到任何关于此的文档。有什么办法?
<md-autocomplete #auto="mdAutocomplete" [displayWith]="displayText.bind(this)">
<md-option (onSelect)="selectItem(item)" *ngFor="let item of filteredItems | async" [value]="item">
{{ item[propertyName] }}
</md-option>
</md-autocomplete>
对于寻找答案的其他人,它已更改为 onSelectionChange
。
您可以使用 keyUp
事件:
(keyup)="selectItem(item)"
刚刚切换到 Angular 4 和 material 2 autoComplete 的 md-option 上的 onSelect() 不再有效,但我找不到任何关于此的文档。有什么办法?
<md-autocomplete #auto="mdAutocomplete" [displayWith]="displayText.bind(this)">
<md-option (onSelect)="selectItem(item)" *ngFor="let item of filteredItems | async" [value]="item">
{{ item[propertyName] }}
</md-option>
</md-autocomplete>
对于寻找答案的其他人,它已更改为 onSelectionChange
。
您可以使用 keyUp
事件:
(keyup)="selectItem(item)"