내 앱에서는지도에 정보 창을 표시하기 위해 Google지도 API v3를 사용하고 있습니다. 정보 창은 $scope
값 으로 채워집니다 . 지도가로드 된 후 $scope
이벤트로 인해 변경되지만 내 정보창의 내용은 여전히 동일합니다.
새로 고침하려면 어떻게해야합니까?
$scope.$apply()
이벤트 콜백 함수가 끝날 때 이미 호출 을 시도 했지만 작동하지 않았습니다.
Controller.js
this.fillingMethod = function(){
info = MyService.getInformation();
$scope.fillingInfo = info;
}
this.changeAnInfo = function(){
var info = $scope.fillingInformation;
var info = MyService.changeInfo(info);
$scope.fillingInformation = info;
$scope.$apply();
}//Google InfoWindow is not refreshed.
View.html
<!-- ng-controller is defined and refers to Controller -->
<map id="map-canvas" center="current-location" zoom="15" ng-init="map.fillingMethod()">
<marker id='test' position="current-location" animation="BOUNCE"></marker>
<info-window id="marker-info" class="gmarker">
<div ng-non-bindable="">
<div id="siteNotice"></div>
<h1 id="firstHeading" class="firstHeading">{{fillingInformation}}</h1>
</div>
</div>
</info-window>
</map>
<button ng-click="changeAnInfo()" />
angular-google-maps 이것을 확인하십시오. 각도에 대한 Google지도입니다. 사용할 사용자 지정 지시문이 있습니다. 단순히 $scope
안에 넣으면 스코프를 .NET에 넣는 것처럼 자동으로 업데이트됩니다 html tags
.
API를 확인하고 window
지시문을 사용 하거나windows
편집 : 코드에 이상한 점이 2 개 있습니다.
ng-non-bindable
앵귤러가 내부를 컴파일하는 것을 막을 것입니다. 아마도 그것을 제거하려고?angular-google-maps
는 angular-ui
. 그렇다면. 그런 다음 사용자 지정 지시문 / attr이 있습니다. 업데이트하려면 태그 안에 정보를 넣으면됩니다.<map id="map-canvas" center="current-location" zoom="15" ng-init="map.fillingMethod()">
<marker id='test' position="current-location" animation="BOUNCE"></marker>
<info-window id="marker-info" class="gmarker">
<div >
<div id="siteNotice"></div>
<h1 id="firstHeading" class="firstHeading">{{fillingInformation[0]}}</h1>
</div>
</div>
</info-window>
</map>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다