From 141ad2579ac0a02cebb0c69c756822d9097120d1 Mon Sep 17 00:00:00 2001 From: David Donges <david.donges@mni.thm.de> Date: Wed, 7 Mar 2018 12:13:32 +0100 Subject: [PATCH] Fix room detail component on param change Now subscribing to route params and reloading data when params change as the component didn't show the new data when navigating to another room detail page. --- src/app/room/room.component.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/room/room.component.ts b/src/app/room/room.component.ts index 6b414efda..582301e28 100644 --- a/src/app/room/room.component.ts +++ b/src/app/room/room.component.ts @@ -16,11 +16,12 @@ export class RoomComponent implements OnInit { } ngOnInit() { - this.getRoom(); + this.route.params.subscribe(params => { + this.getRoom(params['roomId']); + }); } - getRoom(): void { - const roomId: string = this.route.snapshot.paramMap.get('roomId'); - this.roomService.getRoom(roomId).subscribe(room => this.room = room); + getRoom(id: string): void { + this.roomService.getRoom(id).subscribe(room => this.room = room); } } -- GitLab