summaryrefslogtreecommitdiff
path: root/sample-apps
diff options
context:
space:
mode:
authorNick Van Doorn <vandoorn.nick@gmail.com>2019-03-04 01:57:27 -0800
committerNick Van Doorn <vandoorn.nick@gmail.com>2019-03-04 01:57:27 -0800
commitc973da44da1ede938a6b4dfb712226992cc76bbe (patch)
treebddf61b9055d2133c352f3611b205b41cdc203f8 /sample-apps
parente2cf4851bdbdc5ad551728f9e6a3f742f4fb848b (diff)
Add chat room directory to app component
Diffstat (limited to 'sample-apps')
-rw-r--r--sample-apps/angular-chat/src/app/app.component.html6
-rw-r--r--sample-apps/angular-chat/src/app/app.component.ts4
2 files changed, 9 insertions, 1 deletions
diff --git a/sample-apps/angular-chat/src/app/app.component.html b/sample-apps/angular-chat/src/app/app.component.html
index 1e28015..ec6739b 100644
--- a/sample-apps/angular-chat/src/app/app.component.html
+++ b/sample-apps/angular-chat/src/app/app.component.html
@@ -1,4 +1,10 @@
<div>
+ Chat Room directory:
+ <ul>
+ <li *ngFor="let room of (directory$ | async)">
+ {{room}}
+ </li>
+ </ul>
<form>
<label>Username</label>
<input type="text" name="user-id" [(ngModel)]="userId" />
diff --git a/sample-apps/angular-chat/src/app/app.component.ts b/sample-apps/angular-chat/src/app/app.component.ts
index 8048476..02a1f9e 100644
--- a/sample-apps/angular-chat/src/app/app.component.ts
+++ b/sample-apps/angular-chat/src/app/app.component.ts
@@ -14,11 +14,13 @@ export class AppComponent {
userId: string = ''
chatRoomId: string
messages$: Observable<ChatMessage[]>
+ directory$: Observable<string[]>
messageBuff: string
constructor(private messaging: MessagingService) {}
ngOnInit() {
this.messaging.init()
+ this.directory$ = this.messaging.getDirectory()
}
sendMessage() {
@@ -26,7 +28,7 @@ export class AppComponent {
}
async makeChatRoom() {
- this.chatRoomId = await this.messaging.makeChatRoom(this.userId)
+ this.chatRoomId = await this.messaging.makeChatRoom()
this.messages$ = this.messaging.getChatRoom(this.chatRoomId)
}
}