Skip to content

Instantly share code, notes, and snippets.

@thisiszoaib
Created January 5, 2021 05:12
Show Gist options
  • Save thisiszoaib/5e26f11151ab67a0ed5ba73aec0910ab to your computer and use it in GitHub Desktop.
Save thisiszoaib/5e26f11151ab67a0ed5ba73aec0910ab to your computer and use it in GitHub Desktop.
Chips 8
ngAfterViewInit() {
this.chipList.chipSelectionChanges
.pipe(
untilDestroyed(this),
map((event) => event.source))
.subscribe((chip) => {
if (chip.selected) {
this.value = [...this.value, chip.value];
} else {
this.value = this.value.filter((o) => o !== chip.value);
}
this.propagateChange(this.value);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment