저는 현재 내 앱에 Google지도 API를 통합했으며 Google 장소도 포함하고자합니다 (https://developers.google.com/maps/documentation/javascript/examples/place-search). 나는 멀리 Geolocation까지 가지고있다. 그러나 그때부터 나는 다소 잃어버린다. 나는 "슈퍼마켓"에 대한 인근 검색을하고 싶지만 Typescript/angular로 변환하는 데 어려움을 겪고 있습니다.Google Places API - 주변 검색 (이오니아 2)
코드 나는 현재 그 위치 정보가
loadMap입니다 수 있습니다() {
Geolocation.getCurrentPosition().then((position) => {
let latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
let mapOptions = {
center: latLng,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);
}, (err) => {
console.log(err);
});
}
addMarker(){
let marker = new google.maps.Marker({
map: this.map,
animation: google.maps.Animation.DROP,
position: this.map.getCenter()
});
let content = "<h4>You are here!</h4>";
this.addInfoWindow(marker, content);
}
addInfoWindow(marker, content){
let infoWindow = new google.maps.InfoWindow({
content: content
});
google.maps.event.addListener(marker, 'click',() => {
infoWindow.open(this.map, marker);
});
}
누군가가 나에게/통합 높게 평가 될 것입니다 내 현재 코드로 장소 API를 변환 할 수 있다면.
의 사용 가능한 복제 [어떻게 각도 2 구성 요소 내부에 Google지도 API를 통합 할 수 있습니다 (http://stackoverflow.com/questions/37326572/how-can -i-integrate-google-maps-apis-inside-an-angular-2-component) – e666
Google지도와 중복되지 않습니다. API가 제대로 작동하고 있습니다. Google 장소를 추가하고 싶습니다. – BA1995