Skip to content
Snippets Groups Projects
Commit b746b541 authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Add room logic so that the participant-room view displays the current-room...

Add room logic so that the participant-room view displays the current-room information instead of test data
parent 68ea3644
No related merge requests found
......@@ -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>
......
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();
}
}
......@@ -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}`))
);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment