FarmMapsLib/projects/common/src/fm/services/geolocator.service.ts

21 lines
567 B
TypeScript

import { HttpClient } from "@angular/common/http";
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { AppConfig } from "../shared/app.config";
@Injectable({
providedIn: 'root',
})
export class GeolocatorService {
constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
}
ApiEndpoint() {
return this.appConfig.getConfig("apiEndPoint");
}
geocode(address:string): Observable<any> {
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/service/geocode?address=${address}`)
}
}