Skip to content
Snippets Groups Projects
Commit 13d2ce3a authored by Hagen Dreßler's avatar Hagen Dreßler
Browse files

Edit logic components of comment

parent 3e1e2946
Branches
Tags
No related merge requests found
import { Component, OnInit } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Location } from '@angular/common';
import { Comment } from '../comment';
import { CommentService} from '../comment.service';
import { RoomService } from '../room.service';
@Component({
selector: 'app-comment',
......@@ -9,9 +13,32 @@ import { Comment } from '../comment';
export class CommentComponent implements OnInit {
comments: Comment[];
constructor() { }
constructor(
private route: ActivatedRoute,
private roomService: RoomService,
private location: Location,
private commentService: CommentService) { }
ngOnInit() {
this.route.params.subscribe(params => {
this.getRoom(params['roomId']);
});
}
getRoom(id: string): void {
this.roomService.getRoom(id).subscribe(
params => {
this.getComments(params['id']);
}
);
}
getComments(roomId: string): void {
this.commentService.getComments(roomId)
.subscribe(comments => this.comments = comments);
}
goBack(): void {
this.location.back();
}
}
import {Component, OnInit, Input, Inject} from '@angular/core';
import { Component, OnInit, Input } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Location } from '@angular/common';
import { Room } from '../room';
......@@ -6,7 +6,6 @@ import { Comment } from '../comment';
import { RoomService } from '../room.service';
import { CommentService} from '../comment.service';
import { NotificationService } from '../notification.service';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
@Component({
selector: 'app-create-comment',
......
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