1
|
import {Component, OnDestroy, OnInit} from '@angular/core';
|
2
|
import { SearchResponse } from '../../../model/SearchResponse';
|
3
|
import { DataHolderService } from '../../../services/data-holder/data-holder.service';
|
4
|
import {Subscription} from 'rxjs';
|
5
|
|
6
|
@Component({
|
7
|
selector: 'app-search',
|
8
|
templateUrl: './search.component.html',
|
9
|
styleUrls: ['./search.component.css']
|
10
|
})
|
11
|
export class SearchComponent implements OnInit, OnDestroy {
|
12
|
data: SearchResponse;
|
13
|
private queryServiceSubscription$: Subscription;
|
14
|
|
15
|
constructor(private dataHolderService: DataHolderService) {
|
16
|
this.queryServiceSubscription$ = this.dataHolderService.storage$.subscribe(data => {
|
17
|
if (data != null) {
|
18
|
this.data = data;
|
19
|
console.log('prijato: ' + JSON.stringify(this.data));
|
20
|
console.log('prijato_pocet: ' + this.data.textRegions.length);
|
21
|
}});
|
22
|
}
|
23
|
|
24
|
ngOnInit(): void {
|
25
|
}
|
26
|
|
27
|
ngOnDestroy(): void {
|
28
|
this.queryServiceSubscription$.unsubscribe();
|
29
|
}
|
30
|
|
31
|
}
|