Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private subscriptions = new SubSink();
ngOnInit() {
// Method 1
this.subscriptions.add(this.userService.getAllUsers().subscribe(data => {
this.userList = data;
this.userListSubject$.next(this.userList);
}));
// Method 2
this.subscriptions.sink = this.userService.getAllUsers().subscribe(data => {
this.userList = data;
this.userListSubject$.next(this.userList);
});
}
ngOnDestroy() {
this.subscriptions.unsubscribe();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.