Reputation:
I am using PrimeNG. I wrote code for auto-complete as follows
<p-autoComplete name="searchSuggestions" [(ngModel)]="suggestion"
(completeMethod)="searchSuggestions($event)" [suggestions]="searchSuggestionsResult" field="field"></p-autoComplete>
I am clearing suggestion
in a method, but not clearing autocomplete input value. It's clearing only if I select from suggestions.
this.suggestion = undefined;
Upvotes: 5
Views: 8230
Reputation: 38683
Kindly upgrade your primeng
version up to "primeng": "^1.1.1"
, then this will work as well.
Upvotes: 1
Reputation: 41
Use onClear() method & set your model values = null.
====HTML
(onClear)="clearValue()
==ts
clearValue()
{
this.suggestion = null;
}
This function will get called only when you are cleared all the values from auto-complete list.
Hope this will work!!
Upvotes: 2