diff --git a/src/app/create-comment/create-comment.component.ts b/src/app/create-comment/create-comment.component.ts index 8c640402dc53e0fc8f3f66681871083ddc378539..b3d5c1afb4a224f3a18ad784f81ffc3aceedfb3f 100644 --- a/src/app/create-comment/create-comment.component.ts +++ b/src/app/create-comment/create-comment.component.ts @@ -6,6 +6,7 @@ import { Comment } from '../comment'; import { RoomService } from '../room.service'; import { CommentService} from '../comment.service'; import { NotificationService } from '../notification.service'; +import { Router } from '@angular/router'; @Component({ selector: 'app-create-comment', @@ -16,6 +17,7 @@ export class CreateCommentComponent implements OnInit { @Input() room: Room; constructor( + private router: Router, private route: ActivatedRoute, private roomService: RoomService, private commentService: CommentService, @@ -44,6 +46,7 @@ export class CreateCommentComponent implements OnInit { body: body, creationTimestamp: new Date(Date.now()) } as Comment).subscribe(room => { + this.router.navigate([`room/${this.room.id}`]); this.notification.show(`Comment '${subject}' successfully created.`); }); }