Skip to content

Commit

Permalink
Step 9.17: Subscribe to users
Browse files Browse the repository at this point in the history
  • Loading branch information
DAB0mB committed Feb 26, 2017
1 parent 835b399 commit 22f8dd2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client/imports/pages/chats/new-chat.ts
Expand Up @@ -40,7 +40,13 @@ export class NewChatComponent implements OnInit {
}

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[]> {
Expand Down

0 comments on commit 22f8dd2

Please sign in to comment.