Commit 602c5be0 authored by Jeremy M Fee's avatar Jeremy M Fee Committed by Edward J Hunter
Browse files

Add reference place to places service, nearby-places component

parent b1051482
<ng-container *ngIf="placesService.places$ | async as places"> <ng-container *ngIf="placesService.places$ | async as places">
<geoserve-nearby-place-list [places]="places"></geoserve-nearby-place-list> <geoserve-nearby-place-list
</ng-container> [places]="places"
\ No newline at end of file [referencePlace]="placesService.referencePlace"
></geoserve-nearby-place-list>
</ng-container>
export interface Place { export interface Place {
admin1_code: string; admin1_code?: string;
admin1_name: string; admin1_name?: string;
azimuth: number | string; azimuth?: number | string;
country_code: string; country_code?: string;
country_name: string; country_name?: string;
distance: number; distance?: number;
elevation: number; elevation?: number;
feature_class: string; feature_class?: string;
feature_code: string; feature_code?: string;
latitude: number; latitude: number;
longitude: number; longitude: number;
name: string; name?: string;
population: number; population?: number;
} }
...@@ -11,8 +11,11 @@ import { Feature } from './feature'; ...@@ -11,8 +11,11 @@ import { Feature } from './feature';
@Injectable() @Injectable()
export class PlacesService { export class PlacesService {
places$ = new BehaviorSubject<Place[]>(null); places$ = new BehaviorSubject<Place[]>(null);
readonly PLACES_URL = environment.apiUrl + 'places.json'; readonly PLACES_URL = environment.apiUrl + 'places.json';
referencePlace: Place;
constructor(private http: HttpClient) {} constructor(private http: HttpClient) {}
buildUrl(latitude: number, longitude: number): string { buildUrl(latitude: number, longitude: number): string {
...@@ -59,6 +62,10 @@ export class PlacesService { ...@@ -59,6 +62,10 @@ export class PlacesService {
} }
); );
this.referencePlace = {
latitude,
longitude
};
this.places$.next(places); this.places$.next(places);
}); });
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment