📅  最后修改于: 2022-03-11 15:01:47.705000             🧑  作者: Mango
getGeoLocation(address: string): Observable {
console.log('Getting address: ', address);
let geocoder = new google.maps.Geocode();
return Observable.create(observer => {
geocoder.geocode({
'address': address
}, (results, status) => {
if (status == google.maps.GeocoderStatus.OK) {
observer.next(results[0].geometry.location);
observer.complete();
} else {
console.log('Error: ', results, ' & Status: ', status);
observer.error();
}
});
});
}