lemmatized-entity-occurrence.component.ts 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. import { Component, Input } from '@angular/core';
  2. import { take } from 'rxjs/operators';
  3. import { LemmatizedEntityOccurrence, LemmatizedEntityOccurrenceRef } from '../../../models/evt-models';
  4. import { EVTModelService } from '../../../services/evt-model.service';
  5. import { EVTStatusService } from '../../../services/evt-status.service';
  6. @Component({
  7. selector: 'evt-lemmatized-entity-occurrence',
  8. templateUrl: './lemmatized-entity-occurrence.component.html',
  9. styleUrls: ['./lemmatized-entity-occurrence.component.scss'],
  10. })
  11. export class LemmatizedEntityOccurrenceComponent {
  12. @Input() occurrence: LemmatizedEntityOccurrence;
  13. @Input() entityLemId: string;
  14. constructor(
  15. private evtModelService: EVTModelService,
  16. private evtStatusService: EVTStatusService,
  17. ) {
  18. }
  19. goToOccurrenceRef(ref: LemmatizedEntityOccurrenceRef) {
  20. this.evtModelService.pages$.pipe(take(1)).subscribe(pages => {
  21. const page = pages.find(p => p.id === this.occurrence.pageId);
  22. this.evtStatusService.updateDocument$.next(ref.docId);
  23. this.evtStatusService.updatePage$.next(page);
  24. this.evtStatusService.currentLemmatizedEntityId$.next(this.entityLemId);
  25. });
  26. }
  27. }