Newer
Older
import { Component, OnInit } from '@angular/core';
import { Comment } from '../../../models/comment';
import { CommentService } from '../../../services/http/comment.service';
import { TranslateService } from '@ngx-translate/core';
import { LanguageService } from '../../../services/util/language.service';
selector: 'app-comment-list',
templateUrl: './comment-list.component.html',
styleUrls: ['./comment-list.component.scss']
export class CommentListComponent implements OnInit {
constructor(private commentService: CommentService,
private translateService: TranslateService,
protected langService: LanguageService) {
langService.langEmitter.subscribe(lang => translateService.use(lang));
this.roomId = localStorage.getItem(`roomId`);
this.translateService.use(localStorage.getItem('currentLang'));
getComments(): void {
this.commentService.getComments(this.roomId)
.subscribe(comments => {
this.comments = comments;
this.isLoading = false;
});