pinner.component.ts 849 B

1234567891011121314151617181920212223242526
  1. import { Attribute, Component, Input } from '@angular/core';
  2. import { EVTBtnClickEvent } from '../../ui-components/button/button.component';
  3. import { PinboardService } from '../pinboard.service';
  4. @Component({
  5. selector: 'evt-pinner',
  6. templateUrl: './pinner.component.html',
  7. styleUrls: ['./pinner.component.scss'],
  8. })
  9. export class PinnerComponent {
  10. @Input() item;
  11. @Input() additionalStyle: { [key: string]: string | number };
  12. constructor(
  13. @Attribute('pinType') public pinType: string,
  14. @Attribute('renderer') public renderer: string,
  15. private pinboard: PinboardService) { }
  16. isItemPinned() {
  17. return this.pinboard.isItemPinned(this.item);
  18. }
  19. togglePin(btnEvent: EVTBtnClickEvent) {
  20. btnEvent.event.stopPropagation();
  21. this.pinboard.toggleItem(this.item, { pinType: this.pinType, renderer: this.renderer });
  22. }
  23. }