首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我不能更新md-autocomplete的去掉

我不能更新md-autocomplete的去掉
EN

Stack Overflow用户
提问于 2017-10-17 19:07:41
回答 1查看 659关注 0票数 2

我已经用了好几天了。

我有一个自定义的md-autocomplete组件:"@angular/core":"4.2.6","@angular/material":"2.0.0-beta.8",

我需要在最后一次按键的'n‘秒后延迟启动服务调用。模拟约会一切正常,但是,当我的服务有一点延迟的时候。砰!该列表不会出现。

代码语言:javascript
复制
  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(),但没有更新。

谢谢

EN

回答 1

Stack Overflow用户

发布于 2017-11-09 04:02:26

只需删除even组件even处理程序并添加您自己的。这很简单。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46788680

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档