Skip to content

Commit 49f3e88

Browse files
authored
fix(#40): run change detection explicitly to update UI after changing model from outside (#332)
1 parent 942f8e9 commit 49f3e88

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/ng-multiselect-dropdown/src/multiselect.component.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ export class MultiSelectComponent implements ControlValueAccessor {
111111
this.onFilterChange.emit($event);
112112
}
113113

114-
constructor(private listFilterPipe:ListFilterPipe) {}
114+
constructor(
115+
private listFilterPipe:ListFilterPipe,
116+
private cdr: ChangeDetectorRef
117+
) {}
115118

116119
onItemClick($event: any, item: ListItem) {
117120
if (this.disabled || item.isDisabled) {
@@ -171,6 +174,8 @@ export class MultiSelectComponent implements ControlValueAccessor {
171174
this.selectedItems = [];
172175
}
173176
this.onChangeCallback(value);
177+
178+
this.cdr.markForCheck();
174179
}
175180

176181
// From ControlValueAccessor interface

0 commit comments

Comments
 (0)