简体   繁体   English

PrimeNG自动完成功能不显示建议

[英]PrimeNG autocomplete doesn't show suggestions

I'm using PrimeNg p-autocomplete in this way: 我以这种方式使用PrimeNg p-autocomplete:

<p-autoComplete id="area" [(ngModel)]="areaSearch" [ngModelOptions]="{standalone: true}" [suggestions]="results" (completeMethod)="retrieveArea($event)" field="name"></p-autoComplete>

In component: 在组件中:

retrieveArea(event) {
    let searchString = event.query;
    this.results = [];
    searchString = searchString.toUpperCase();
    this.service.retrieveAreaCa(searchString).subscribe(response => {
        if (response.result) {
          this.results = response.data.list;
          //list = [{"name": "Paris", "code": "001"}, ...]
        },
        }
      });
  }

It worked fine with PrimeNG version 4.0.1 but, after updating to 4.2.0, it doesn't show suggestions on typing. 它在PrimeNG 4.0.1版本上可以正常工作,但是在更新到4.2.0之后,它没有显示输入建议。 I think there aren't differences to do in code after updating but I can't understand why it doesn't work. 我认为更新后代码没有区别,但是我不明白为什么它不起作用。 Any suggestions? 有什么建议么?

This component is not stable yet. 该组件还不稳定。 There are some known issues about it. 有一些已知的问题。 I had the same and after update to PrimeNG 4.3.0 everything works fine. 我有相同的东西,更新到PrimeNG 4.3.0之后,一切正常。

See these 1 and 2 from PrimeNG's Github 请参阅PrimeNG的Github的这些12

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM