From f9aacd4197fe6d1454735dcd4098b9e2b292686b Mon Sep 17 00:00:00 2001 From: Hagen <hagen.dressler@mni.thm.de> Date: Wed, 7 Mar 2018 23:33:34 +0100 Subject: [PATCH] Edit component create-comment --- src/app/create-comment/create-comment.component.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/create-comment/create-comment.component.ts b/src/app/create-comment/create-comment.component.ts index 59e8b2d93..f53b5eb80 100644 --- a/src/app/create-comment/create-comment.component.ts +++ b/src/app/create-comment/create-comment.component.ts @@ -22,20 +22,20 @@ export class CreateCommentComponent implements OnInit { ) { } ngOnInit(): void { - // this.getRoom(); + this.route.params.subscribe(params => { + this.getRoom(params['roomId']); + }); } - getRoom(): void { - const id = this.route.snapshot.paramMap.get('id'); - this.roomService.getRoom(id) - .subscribe(room => this.room = room); + getRoom(id: string): void { + this.roomService.getRoom(id).subscribe(room => this.room = room); } send(subject: string, text: string): void { subject = subject.trim(); text = text.trim(); if (!subject || !text) { return; } - this.commentService.addComment( { subject } as Comment ) + this.commentService.addComment( { subject: subject, body: text } as Comment ) .subscribe(); } -- GitLab