我已经用了好几天了。
我有一个自定义的md-autocomplete组件:"@angular/core":"4.2.6","@angular/material":"2.0.0-beta.8",
我需要在最后一次按键的'n‘秒后延迟启动服务调用。模拟约会一切正常,但是,当我的服务有一点延迟的时候。砰!该列表不会出现。
filterAutocomplete() {
this.filteredOptions = this.autocompleteControl.valueChanges
.startWith(null)
// delay
.debounceTime(this.autoProperties.time)
// call service method
.map(textSearch => this.FilterList(textSearch))
// unique event
.distinctUntilChanged();
}
FilterList(textSearch: string): any[] {
this.ref.detectChanges();
this.searchEmiter.emit(textSearch ? textSearch : '');
return this.listReg;}
this.filteredOptions用于在视图中绘制列表
this.FilterList向父亲发起了一个事件,并调用了服务。然后,使用发送到md-autocomplete的参数更新对象
我尝试使用this.changeDetectorRef.detectChanges(),但没有更新。
谢谢
发布于 2017-11-09 04:02:26
只需删除even组件even处理程序并添加您自己的。这很简单。
https://stackoverflow.com/questions/46788680
复制相似问题