import { Injectable } from '@angular/core'; import { environment } from '../../environments/environment'; import { Observable } from 'rxjs'; import { HttpClient } from '@angular/common/http'; export interface GeoResult { city: string; state: string; state_code: string } @Injectable({ providedIn: 'root' }) export class GeoService { private apiBaseUrl = environment.apiBaseUrl; constructor(private http: HttpClient) { } findCitiesStartingWith(prefix:string, state?:string):Observable{ const stateString = state?`/${state}`:'' return this.http.get(`${this.apiBaseUrl}/bizmatch/geo/${prefix}${stateString}`); } }