Skip to content

Instantly share code, notes, and snippets.

@debugmodedotnet
Created December 9, 2020 02:21
Show Gist options
  • Save debugmodedotnet/906958877996e785b94e24990276f9b0 to your computer and use it in GitHub Desktop.
Save debugmodedotnet/906958877996e785b94e24990276f9b0 to your computer and use it in GitHub Desktop.
private filterDataSource: BehaviorSubject<Array<any>> = new BehaviorSubject([]);
public filterData = this.filterDataSource.asObservable();
updateUserData(data) {
this.filterDataSource.next(data);
}
addData(dataObj) {
const currentValue = this.filterDataSource.value;
const updatedValue = [...currentValue, dataObj];
this.filterDataSource.next(updatedValue);
}
constructor() { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment