FarmMapsLib/projects/common/src/fm/services/codelistitem.service.ts
Peter Bastiani 05705afdfe
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
AW-803 Fix casing issue. Remove unused parms.
2020-01-28 09:50:33 +01:00

26 lines
787 B
TypeScript

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");
}
getCodeListItems(codelist: string[]): Observable<ICodeListItem[]> {
var params = new HttpParams();
for (const cl of codelist) {
params = params.append('cl', cl);
}
return this.httpClient.get<ICodeListItem[]>(`${this.ApiEndpoint()}/api/v1/codelistitems/`, { params: params });
}
}