4

I am using ng-select on a modal.

<div class="modal-body">
<div class="form-group has-feedback">
<ng-select #select name="currenies" [allowClear]="true" [items]="currencyList" [disabled]="disabled" (selected)="selected($event)" 
                        placeholder="Currency description + ISO code">
 </ng-select>

 </div>
</div>

After I close the modal, selected value attached to html remains constant. How to reset the ng-select?

KNimhan
  • 91
  • 2
  • 6

2 Answers2

3

u can reset it using the method clear when the modal is closed :

 <div class="modal-body" (onClose)="select.clear()">
Mohamed Ali RACHID
  • 3,245
  • 11
  • 22
-3

You can use this

$('#modal_id').on('hidden.bs.modal', function (e) {
  $(this).find("select").val('').end();
})
sagar patel
  • 591
  • 5
  • 18