Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Step 9.17: Subscribe to users
  • Loading branch information
dotansimha authored and darkbasic committed Oct 16, 2017
1 parent b5b1da6 commit 6c8162c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pages/chats/new-chat.ts
Expand Up @@ -40,7 +40,13 @@ export class NewChatComponent implements OnInit {
} }


loadUsers(): void { loadUsers(): void {
this.users = this.findUsers(); // Fetch all users matching search pattern
const subscription = MeteorObservable.subscribe('users');
const autorun = MeteorObservable.autorun();

Observable.merge(subscription, autorun).subscribe(() => {
this.users = this.findUsers();
});
} }


findUsers(): Observable<User[]> { findUsers(): Observable<User[]> {
Expand Down

0 comments on commit 6c8162c

Please sign in to comment.