opt-cc/static/src/app/decorations/decoration-list/decoration-item.component.ts

47 lines
1.2 KiB
TypeScript
Raw Normal View History

2017-05-10 11:04:06 +02:00
import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
import {Router} from "@angular/router";
import {Decoration} from "../../models/model-interfaces";
@Component({
selector: 'pjm-decoration-item',
templateUrl: './decoration-item.component.html',
styleUrls: ['./decoration-item.component.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
inputs: ['decoration', 'selected'],
outputs: ['decorationDelete','decorationSelected'],
2017-05-10 11:04:06 +02:00
})
export class DecorationItemComponent {
selected: boolean;
decoration: Decoration;
imageSrc;
previewMargin;
2017-05-10 11:04:06 +02:00
decorationSelected = new EventEmitter();
decorationDelete = new EventEmitter();
2017-05-10 11:04:06 +02:00
constructor(private router: Router) {
}
2017-05-10 11:04:06 +02:00
ngOnInit() {
this.imageSrc = 'resource/decoration/' + this.decoration._id + '.png?' + Date.now();
if (!this.decoration.isMedal) {
this.previewMargin = '17px'
}
2017-05-10 11:04:06 +02:00
}
select() {
this.decorationSelected.emit(this.decoration._id)
}
delete() {
this.decorationDelete.emit(this.decoration);
}
2017-05-10 11:04:06 +02:00
ngAfterViewChecked() {
//var taskId = (this.task ? this.task.id : '');
// console.log(`Task ${taskId} checked ${++this.checkCounter} times`)
}
}