Is it possible to programmatically clear the selection of an ng-select dropdown? I\'m wanting the equivalent behaviour of clicking the clear icon, but triggered programmatically
Even thought @Buczkowski answer clears ng-select
, it also does a focus on input, which isn't needed for all cases. So i used other method: clearModel
// Access ng-select
@ViewChild(NgSelectComponent) ngSelectComponent: NgSelectComponent;
// Call to clear
this.ngSelectComponent.clearModel();
So if you need to just clear input, use clearModel
method. Else if focus and clear is needed, use handleClearClick
.