diff --git a/src/app/participant-room/participant-room.component.html b/src/app/participant-room/participant-room.component.html index 7f6f4ae502fd512e1942a78eb5ee95fd69e3a91a..c5cfec5390c168b6528c784f62ae5087502281a1 100644 --- a/src/app/participant-room/participant-room.component.html +++ b/src/app/participant-room/participant-room.component.html @@ -2,13 +2,13 @@ <div fxLayout="row" fxLayoutAlign="center"> <mat-card> <mat-card-header> - <mat-card-title><h3 class="subheading-2">{{ roomName }}</h3></mat-card-title> - <mat-card-subtitle>{{ roomId }}</mat-card-subtitle> + <mat-card-title><h3 class="subheading-2">{{ room.name }}</h3></mat-card-title> + <mat-card-subtitle>{{ room.shortId }}</mat-card-subtitle> </mat-card-header> <mat-divider></mat-divider> <mat-card-content> <p> - {{ roomDescription }} + {{ room.description }} </p> </mat-card-content> <mat-divider></mat-divider> diff --git a/src/app/participant-room/participant-room.component.ts b/src/app/participant-room/participant-room.component.ts index 53c52e01a09100bbc0b3b6b3f832ea5422615399..8c99c196ca9241ba63f30615b8b0892aaf8e9fee 100644 --- a/src/app/participant-room/participant-room.component.ts +++ b/src/app/participant-room/participant-room.component.ts @@ -1,6 +1,8 @@ import { Component, OnInit } from '@angular/core'; import { Room } from '../room'; import { Location } from '@angular/common'; +import { RoomService } from '../room.service'; +import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-participant-room', @@ -19,13 +21,24 @@ export class ParticipantRoomComponent implements OnInit { 'tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea ' + 'rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.'; - constructor(private location: Location) { + constructor(private location: Location, + private roomService: RoomService, + private route: ActivatedRoute) { } ngOnInit() { + this.route.params.subscribe(params => { + this.getRoom(params['roomId']); + }); } - goBack() { + getRoom(id: string): void { + this.roomService.getRoom(id) + .subscribe(room => this.room = room); + } + + + goBack(): void { this.location.back(); } } diff --git a/src/app/room.service.ts b/src/app/room.service.ts index 77b492462aeb0bdea0cb39feaa5a358b9d81b451..5f4fc2796b9dc7e031a00103aeca388e111c1e8a 100644 --- a/src/app/room.service.ts +++ b/src/app/room.service.ts @@ -34,8 +34,7 @@ export class RoomService extends ErrorHandlingService { getRoom(id: string): Observable<Room> { const url = `${this.roomsUrl}/${id}`; return this.http.get<Room>(url).pipe( - tap(_ => ''), - catchError(this.handleError<Room>(`getRoom id=${id}`)) - ); + catchError(this.handleError<Room>(`getRoom id=${id}`)) + ); } }