如何在 Mat-select-autocomplete 中显示"No result found"?



我使用了mat-select-autocomplete用于多选下拉菜单。如果我搜索其他值,我需要显示"没有结果"。我怎样才能做到这一点呢?https://stackblitz.com/edit/mat-select-autocomplete-bjln34?file=src/app/app.component.ts

当前包的API似乎不可能。正如您在文档和实现中看到的,当一个选项被切换时,只有一个输出事件被触发。

@Output()
selectionChange: EventEmitter<any> = new EventEmitter();

对于您想要的可能性,方法filterItem()方法也应该是一个输出,然后您可以使用ngIf来切换标签。

最新更新