Newer
Older
// The code in this file and the files using this file is partially taken from
// https://stackoverflow.com/questions/46487255/pass-observable-data-from-parent-component-to-a-child-component-created-with-com
import { Injectable } from '@angular/core';
import { Subject, Observable } from 'rxjs';
import { IMetadataSelection, MetadataSelection } from 'app/search/metadata/metadata-selection.component';
filterSelection$: Observable<IMetadataSelection>;
private filterSelectionSubject: Subject<IMetadataSelection> = new Subject<IMetadataSelection>();
constructor() {
this.filterSelection$ = this.filterSelectionSubject.asObservable();
}
public updateFilterSelection(metadataCategory: string, value: string): void {
this.filterSelectionSubject.next(new MetadataSelection(metadataCategory, value));