Say, I have the following typescript which contains enlightenFilters$ :
import { Component, Input, OnInit } from "@angular/core";
import { ConfigType, LisaConfig } from "app/enrichment/models/lisa/configuration.model";
import { Observable } from "rxjs";
import { EnrichmentFilters } from "../../models/lisa/filter.model";
import { select, Store } from "@ngrx/store";
import { EnrichmentFiltersState } from "../../reducers/enrichment-filters.reducer";
import { getPropertyEnrichmentFilters, getRateEnrichmentFilters } from "../../selectors/enrichment-filters.selectors";
@Component({
selector: "app-lisa-config",
templateUrl: "./lisa-config.component.html"
})
export class LisaConfigComponent implements OnInit {
@Input() public config: LisaConfig;
public enlightenFilters$: Observable<EnrichmentFilters>;
constructor(private store$: Store<EnrichmentFiltersState>) {
}
ngOnInit() {
switch (this.config.configType) {
case ConfigType.RATE:
this.enlightenFilters$ = this.store$.pipe(select(getRateEnrichmentFilters));
break;
case ConfigType.PROPERTY:
this.enlightenFilters$ = this.store$.pipe(select(getPropertyEnrichmentFilters));
break;
}
}
}
I want to access the above enlightenFilters$ from the following typescript and store it's data into a variable named enlighten:
import { Component, Input } from "@angular/core";
import { Filter } from "app/enrichment/models/lisa/filter.model";
import { isArray, has } from "lodash";
import { LisaConfigComponent } from "app/enrichment/components/lisa-config/lisa-config.component";
@Component({
templateUrl: "./filters.component.html",
selector: "app-lisa-config-filters",
})
export class FiltersComponent {
@Input() public filters: Filter[];
// want to store data from enlightenFilters$ into enlighten
// public enlighten: LisaConfigComponent;
constructor() {}
useGroupsLogic(filter: Filter): boolean {
return isArray(filter.groups);
}
useKeywordsLogic(group: any): boolean {
return has(group, "keywords");
}
}
So that I can use enlighten into .html file like below:
<ng-container *ngFor="let filter of filters">
<div>{{ filter.name }}
<li *ngIf='{
enlightenFilters: enlighten | async
} as data'>
<ng-container>
<ul>
<ng-container *ngFor="let enlightenFilter of data.enlightenFilters">
<li *ngif="enlightenFilter.hasOwnProperty('description') && enlightenFilter.name === filter.name">
<mat-icon
#tooltip="matTooltip"
style="cursor: pointer"
matTooltip="Test Tooltip"
matTooltipPosition="right"
>info_outline</mat-icon>
</li>
</ng-container>
</ul>
</ng-container>
</li>
</div>
<ul>
<li *ngIf="filter.group">Group: {{ filter.group }}</li>
</ul>
</ng-container>
How can I achieve this?
(I tried exporting from one typescript and importing in other one following https://bobbyhadz.com/blog/typescript-import-variable-from-another-file, it was not successful)


