File

src/app/_services/location.service.ts

Index

Methods

Constructor

constructor(httpClient: HttpClient)
Parameters :
Name Type Optional
httpClient HttpClient No

Methods

getAreaNameByLocation
getAreaNameByLocation(location: string)
Parameters :
Name Type Optional
location string No
Returns : Observable<any>
getAreaNames
getAreaNames()
Returns : Observable<any>
getAreaTypeByArea
getAreaTypeByArea(area: string)
Parameters :
Name Type Optional
area string No
Returns : Observable<any>
getAreaTypes
getAreaTypes()
Returns : Observable<any>
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from '@src/environments/environment';
import { first } from 'rxjs/operators';
import { HttpClient } from '@angular/common/http';

@Injectable({
  providedIn: 'root',
})
export class LocationService {
  constructor(private httpClient: HttpClient) {}

  getAreaNames(): Observable<any> {
    return this.httpClient.get(`${environment.cicMetaUrl}/areanames`);
  }

  getAreaNameByLocation(location: string): Observable<any> {
    return this.httpClient.get(`${environment.cicMetaUrl}/areanames/${location.toLowerCase()}`);
  }

  getAreaTypes(): Observable<any> {
    return this.httpClient.get(`${environment.cicMetaUrl}/areatypes`).pipe(first());
  }

  getAreaTypeByArea(area: string): Observable<any> {
    return this.httpClient
      .get(`${environment.cicMetaUrl}/areatypes/${area.toLowerCase()}`)
      .pipe(first());
  }
}

result-matching ""

    No results matching ""