initial commit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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()
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user