1
我已經使用谷歌地圖使用AngularJs哪些工作正常。然而,在點擊任何標記信息窗口將打開,但我需要通過點擊地圖之外的單選按鈕來打開它,這裏是代碼示例通過點擊AngularJS中的按鈕打開infowindow
HTML
<ng-map default-style="true" center="[24.8615, 67.0099]" zoom="11" scroll-wheel="false" zoom-to-inculude-markers="auto">
<info-window id="rider">
<div ng-non-bindable="">
{{vm.store.name}} <br/>
{{vm.store.title}}<br/>
</div>
</info-window>
<marker ng-repeat="(id, store) in vm.stores" id="{{id}}" icon="../assets/images/rider.png"
position="{{store.position}}"
on-click="vm.showStore(event, id)"></marker>
的JavaScript/AngularJs
vm.stores = [
{position: [24.8820869, 67.06881520000002], title: 'Bahadrubad'},
{position: [24.8753973, 67.04096709999999], title: 'Mazar e Quaid'},
{position: [24.8758, 67.0230], title: 'Karachi Zoo'},
{position: [24.8532941, 67.01622309999993], title: 'Saddar Town'}
];
NgMap.getMap().then(function (map) {
vm.map = map;
});
vm.showStore = function (e, storeId) {
vm.store = vm.stores[storeId];
vm.map.showInfoWindow('rider', this);
};
我用超時功能$超時(函數( ){// infowindow code here});和一切工作正常,問題是點擊後,我需要顯示在ajax響應後的信息窗口,它創造的問題,因此我把infoWindow代碼在angularJs itmeout函數,它的工作原理。多謝你的幫助。 –