When a button is clicked the updateLocation method is called but I'm getting an "coordinates" is null error.
Any ideas?
export class SharedLocationComponent {
@Input() coordinates: CoordinateModel;
updateLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(this.setCoordinates, function () {
return true;
});
}
}
setCoordinates(coordinates) {
let c = coordinates.coords
if (c) {
this.coordinates = new CoordinateModel(c.latitude, c.longitude);
}
}
}