bstlboard-front/src/app/pages/comment/comment.page.ts

38 lines
851 B
TypeScript

import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { CommentService } from '../../services/comment.service';
@Component({
selector: 'page-comment',
templateUrl: './comment.page.html',
styleUrls: ['./comment.page.scss']
})
export class PageComment implements OnInit {
id: number;
comment: any;
notfound: boolean = false;
ignoreSubcomments: string[] = ['entry'];
constructor(private commentService: CommentService,
private route: ActivatedRoute) { }
ngOnInit(): void {
this.id = +this.route.snapshot.paramMap.get('id');
this.commentService.getComment(this.id).subscribe({
next: (data) => {
this.comment = data;
},
error: (error) => {
if (error.status == 404) {
this.notfound = true;
}
}
})
}
}