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 route: ActivatedRoute,
private roomService: RoomService,
private location: Location,
private commentService: CommentService,
private notification: NotificationService,
private translateService: TranslateService,
protected langService: LanguageService) {
langService.langEmitter.subscribe(lang => translateService.use(lang));
this.roomId = localStorage.getItem(`roomId`);
this.translateService.use(localStorage.getItem('currentLang'));
this.commentService.getComments(this.roomId)
.subscribe(comments => {
this.comments = comments;
this.isLoading = false;
});
}
searchComments(term: string): void {
this.filteredComments = this.comments.filter(c => c.body.toLowerCase().includes(term));