google map
のionic 3
私はプレーンjavascript
を使用していますので、私の携帯に表示されていないと思います。 how to get current postion name using google map apiイオンの現在の位置を取得できません3
私は同じ達成したい3
import { Geolocation } from '@ionic-native/geolocation';
loadMap(){
this.geolocation.getCurrentPosition().then((position) => {
let latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
// don't know further steps
}, (err) => {
console.log(err);
});
}
質問をイオン性に変換しようとした:ここ
は私のコードはここに
geocodeLatLng(lat, lng) {
var geocoder = new google.maps.Geocoder;
var latlng = {
lat: lat,
lng: lng
};
geocoder.geocode({
'location': latlng
}, (results, status) => {
if (status === 'OK') {
if (results[0]) {
console.log(results[0].formatted_address);
} else {
window.alert('No results found');
}
} else {
window.alert('Geocoder failed due to: ' + status);
}
});
}
デモオンラインですこの結果はイオン性である3:how to get current postion name using google map api
あなたが が含まれていたん '' <スクリプトは、非同期= "https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap" SRCを延期>? –
はい私はこれを 'index.html' – EaB
に含めました。あなたはapp.module.tsファイルにジオロケーションモジュールをインポートしましたか? –