initial commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { CommentService } from '../../services/comment.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ui-commentcount',
|
||||
templateUrl: './commentcount.ui.html',
|
||||
styleUrls: [ './commentcount.ui.scss' ]
|
||||
})
|
||||
export class UiCommentCount implements OnInit {
|
||||
|
||||
count: number;
|
||||
@Input() target: number;
|
||||
@Input() parent: number;
|
||||
|
||||
constructor(private commentService: CommentService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.target && this.parent) {
|
||||
this.commentService.countParent(this.target, this.parent).subscribe((data) => {
|
||||
this.count = +data;
|
||||
});
|
||||
} else if (this.target) {
|
||||
this.commentService.count(this.target).subscribe((data) => {
|
||||
this.count = +data;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user