Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

import { Injectable } from '@angular/core';
import { FilesModel } from '../ewv-viewer/ewv-viewer.model';
import { HttpClient } from '@angular/common/http';
import { environment } from '../../../environments/environment';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/do';
import { Subscription } from 'rxjs/Subscription';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import {
MenuModel,
DropDownModel
} from '../../shared/menu/menu.component.model';

@Injectable()
export class PdfReferenceService {
value = 0;
pdfSubscription: Subscription= new Subscription();

pdfReferenceDropDown$: BehaviorSubject<
Array<DropDownModel>
> = new BehaviorSubject(null);
pdfReferenceDropDown = [];
ewvMenu: MenuModel = new MenuModel();
constructor(private _http: HttpClient) {}


getAllPdfReferences() {
return this._http
.get<Array<FilesModel>>(
`${environment.nodeserver}/ewv/pdfReference/getAll`
)
.map(response => response['pdfReferencesList']);
}

populatePdfReferenceMenu() {
const dropDowns: DropDownModel[] = [];
this._http
.get<Array<FilesModel>>(
`${environment.nodeserver}/ewv/pdfReference/getAll`
)
.map(response => response['pdfReferencesList'])
.subscribe(data => {
for (const reference of data) {
const referenceItem = new DropDownModel();
referenceItem.alt = reference.alt;
referenceItem.heading = reference.alt;
referenceItem.bindClick = true;
referenceItem.guid = reference.guid;
dropDowns.push(referenceItem);
}
this.pdfReferenceDropDown$.next(dropDowns);
});
return this.pdfReferenceDropDown$;
}
}