valor-software/ng2-select

How can I clear the value of a select?

wautersj opened this issue · 0 comments

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;

screen shot 2018-05-22 at 01 33 29

Help would be much appreciated!