How can I clear the value of a select?
wautersj opened this issue · 0 comments
wautersj commented
I want to programatically clear the select and reset it in its original state.
But am unable to do so.
I have tried to set the ngModel property to null, but this only works once.
After resetting it a second time, the dropdown renders "undefined".
<iq-select2 #documentSearch css="form-control input-sm"
[dataSourceProvider]="listDocuments"
[iqSelect2ItemAdapter]="adapter"
[selectedProvider]=""
[placeholder]="placeholder"
referenceMode="entity"
(onSelect)="fileSelected($event)"
(onRemove)="fileRemoved($event)"
[(ngModel)]="selectedDocument"
>
In code, I call this:
this.selectedDocument = null;
Help would be much appreciated!