32 lines
703 B
TypeScript
32 lines
703 B
TypeScript
import { Component, OnInit, Input } from '@angular/core';
|
|
import { VoteService } from '../../services/vote.service';
|
|
|
|
@Component({
|
|
selector: 'ui-entry',
|
|
templateUrl: './entry.ui.html',
|
|
styleUrls: [ './entry.ui.scss' ]
|
|
})
|
|
export class UiEntry implements OnInit {
|
|
|
|
@Input() entry: any;
|
|
@Input() index : number;
|
|
@Input() change : Function;
|
|
|
|
constructor(private voteService: VoteService) { }
|
|
|
|
ngOnInit(): void {
|
|
|
|
}
|
|
|
|
voteUp() {
|
|
this.voteService.voteEntryUp(this.entry.id).subscribe((result) => {
|
|
this.change && this.change()
|
|
});
|
|
}
|
|
|
|
voteDown() {
|
|
this.voteService.voteEntryDown(this.entry.id).subscribe((result) => {
|
|
this.change && this.change()
|
|
});
|
|
}
|
|
} |