bstlboard-front/src/app/ui/points/points.ui.ts

30 lines
717 B
TypeScript

import { Component, OnInit, Input } from '@angular/core';
import { VoteService } from '../../services/vote.service';
@Component({
selector: 'ui-points',
templateUrl: './points.ui.html',
styleUrls: [ './points.ui.scss' ]
})
export class UiPoints implements OnInit {
count: number;
@Input() target: number;
@Input() type: string;
constructor(private voteService: VoteService) { }
ngOnInit(): void {
if (this.type == 'e') {
this.voteService.getEntryPoints(this.target).subscribe((data) => {
this.count = +data;
});
} else if (this.type == 'c') {
this.voteService.getCommentPoints(this.target).subscribe((data) => {
this.count = +data;
});
}
}
}