pages + refactor
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { CommentService } from '../../services/comment.service';
|
||||
import { UiComments } from '../../ui/comments/comments.ui';
|
||||
|
||||
@Component({
|
||||
selector: 'page-comment',
|
||||
templateUrl: './comment.page.html',
|
||||
styleUrls: [ './comment.page.scss' ]
|
||||
})
|
||||
export class PageComment implements OnInit {
|
||||
|
||||
id: number;
|
||||
comment: any;
|
||||
notfound: boolean = false;
|
||||
|
||||
constructor(private commentService: CommentService,
|
||||
private route: ActivatedRoute) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.id = +this.route.snapshot.paramMap.get('id');
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
refresh() {
|
||||
this.commentService.getComment(this.id).subscribe((data) => {
|
||||
this.comment = data;
|
||||
}, (error) => {
|
||||
if (error.status == 404) {
|
||||
this.notfound = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user