concept geolocation callback function in category angular
appears as: geolocation callback functions, geolocation callback functions

This is an excerpt from Manning's book Getting MEAN with Mongo, Express, Angular, and Node.js 2ED.
Listing 9.16. Setting up the geolocation callback functions in home-list.component.ts
export class HomeListComponent implements OnInit { constructor( private loc8rDataService: Loc8rDataService, private geolocationService: GeolocationService ) { } public locations: Location[]; public message: string; #1 private getLocations(position: any): void { this.message = 'Searching for nearby places'; #2 this.loc8rDataService .getLocations() .then(foundLocations => { this.message = foundLocations.length > 0 ? '' : 'No locations found'; #2 this.locations = foundLocations; }); } private showError(error: any): void { #3 this.message = error.message; #3 }; #3 private noGeo(): void { #4 this.message = 'Geolocation not supported by this browser.'; #4 }; #4 ngOnInit() { this.getLocations(); } }