我在我的angular 7项目中使用ng-multiselect-dropdown。我想重置下拉列表的值,所以我使用下面的方法,但只清除了变量中存储的值; dom值未在我的模板中清除。我也需要验证。请帮助我。
resetSelection() {
this.selectedTestCompounds = [];
}
<ng-multiselect-dropdown
id="testSample"
[placeholder]="'select'"
[data]="sampleList"
[(ngModel)]="selectedTestCompounds"
[settings]="dropdownSettingsTestCompound"
(onSelect)="onItemSelectTestCompound($event)"
(onSelectAll)="onSelectAllTestCompound($event)"
>
</ng-multiselect-dropdown>
<button (click)="resetSelection()" >clear</button>