Skip to content

Commit

Permalink
reset tagging controls on document switch
Browse files Browse the repository at this point in the history
close #1324
  • Loading branch information
lukavdplas committed Nov 23, 2023
1 parent f99068f commit e0f686c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions frontend/src/app/tag/document-tags/document-tags.component.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { FoundDocument, Tag } from '../../models';
import { faPlus, faTimes } from '@fortawesome/free-solid-svg-icons';
import { first, map, mergeMap } from 'rxjs/operators';
import * as _ from 'lodash';

@Component({
selector: 'ia-document-tags',
templateUrl: './document-tags.component.html',
styleUrls: ['./document-tags.component.scss'],
})
export class DocumentTagsComponent implements OnInit {
export class DocumentTagsComponent implements OnChanges {
@Input() document: FoundDocument;

faTimes = faTimes;
Expand All @@ -19,7 +18,11 @@ export class DocumentTagsComponent implements OnInit {

constructor() {}

ngOnInit(): void {}
ngOnChanges(changes: SimpleChanges): void {
if (changes.document) {
this.showAddNew = false;
}
}

addTag(tag: Tag) {
this.document.addTag(tag);
Expand Down

0 comments on commit e0f686c

Please sign in to comment.