I 위도 & 길이로 장소를 지오 코드를 리버스 다음 지시문이 있습니다 추가 NG-모델은 강령
/* global app*/
app.directive('reverseGeocode', function() {
return {
restrict: 'A',
template: '<div ng-model="autoLocation"></div>',
link: function (scope, element, attrs) {
var geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(attrs.lat, attrs.lng);
geocoder.geocode({ 'latLng': latlng }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
element.text(results[1].formatted_address);
} else {
element.text('Location not found');
}
} else {
element.text('');
}
});
},
require: "ngModel",
replace: true
}
});
그러나 어떤 이유로, NG 모델 및 디스플레이를 검색하지 않는 것
그것은 :<div ng-if="capture.geo">Place: {{autoLocation}}</div>
, 어디 CLO입니다 '역 지오 코드 (reverse-geocode) '지시어를 부르시겠습니까? –
를 제공 할 수
![image](https://i.stack.imgur.com/lk5e8.png)
–