Skip to content

Commit

Permalink
fix(#40): run change detection explicitly to update UI after changing…
Browse files Browse the repository at this point in the history
… model from outside (#332)
  • Loading branch information
gserg authored Sep 15, 2021
1 parent 942f8e9 commit 49f3e88
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ng-multiselect-dropdown/src/multiselect.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ export class MultiSelectComponent implements ControlValueAccessor {
this.onFilterChange.emit($event);
}

constructor(private listFilterPipe:ListFilterPipe) {}
constructor(
private listFilterPipe:ListFilterPipe,
private cdr: ChangeDetectorRef
) {}

onItemClick($event: any, item: ListItem) {
if (this.disabled || item.isDisabled) {
Expand Down Expand Up @@ -171,6 +174,8 @@ export class MultiSelectComponent implements ControlValueAccessor {
this.selectedItems = [];
}
this.onChangeCallback(value);

this.cdr.markForCheck();
}

// From ControlValueAccessor interface
Expand Down

0 comments on commit 49f3e88

Please sign in to comment.