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
dotansimha authored and DAB0mB committed Mar 23, 2017
1 parent d5dbafb commit f7ddefa
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 {
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 f7ddefa

Please sign in to comment.