2020-01-21 13:52:36 +00:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { HttpClient, HttpParams } from "@angular/common/http";
|
|
|
|
import { AppConfig } from "../shared/app.config";
|
|
|
|
import { ICodeListItem } from '../models/code.list.item';
|
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
providedIn: 'root',
|
|
|
|
})
|
|
|
|
export class CodeListItemService {
|
|
|
|
constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiEndpoint() {
|
|
|
|
return this.appConfig.getConfig("apiEndPoint");
|
|
|
|
}
|
|
|
|
|
2020-01-28 08:50:33 +00:00
|
|
|
getCodeListItems(codelist: string[]): Observable<ICodeListItem[]> {
|
2020-01-21 13:52:36 +00:00
|
|
|
var params = new HttpParams();
|
2020-01-22 13:18:09 +00:00
|
|
|
for (const cl of codelist) {
|
|
|
|
params = params.append('cl', cl);
|
|
|
|
}
|
2020-01-22 09:05:03 +00:00
|
|
|
return this.httpClient.get<ICodeListItem[]>(`${this.ApiEndpoint()}/api/v1/codelistitems/`, { params: params });
|
2020-01-21 13:52:36 +00:00
|
|
|
}
|
|
|
|
}
|