Peter Bastiani
05705afdfe
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
26 lines
787 B
TypeScript
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 });
|
|
}
|
|
}
|