Html 启动:p-自动完成未清除值

Html 启动:p-自动完成未清除值,html,angularjs,primeng,Html,Angularjs,Primeng,我正在使用素描。我为autocomplete编写了如下代码 <p-autoComplete name="searchSuggestions" [(ngModel)]="suggestion" (completeMethod)="searchSuggestions($event)" [suggestions]="searchSuggestionsResult" field="field"></p-autoComplete> 请将您的priming版本升级到“primin

我正在使用素描。我为autocomplete编写了如下代码

<p-autoComplete name="searchSuggestions" [(ngModel)]="suggestion" 
(completeMethod)="searchSuggestions($event)" [suggestions]="searchSuggestionsResult" field="field"></p-autoComplete>

请将您的
priming
版本升级到
“priming”:“^1.1.1”
,这样也可以工作。

使用onClear()方法并将您的模型值设置为null

==HTML

(onClear)="clearValue()
==ts

仅当清除自动完成列表中的所有值时,才会调用此函数


希望这能奏效

我也在用这个。但这对我来说是有效的:(你想清除所选值或需要清除所有建议?不是两者都要,想清除垃圾值我键入但
this.suggestion=undefined;
这段代码为myside做这件事。你能在JSFIDLE中添加它吗?我在IE中使用IE.Fine for u?谢谢Ramesh。是的,在升级时,我正在使用npm 4.0.2Bizarre,默认情况下该控件清除值时不绑定空/未定义/空字符串。
(onClear)="clearValue()
clearValue()
{
    this.suggestion = null;
}