我在github上使用了allenhwkim的angularjs-google-maps指令,因为我是新手,所以无法发布链接。
我正在此Firebase社交身份验证入门工具包的基础上构建我的应用程序:https : //market.ionic.io/starters/firebase-v3-auth-social-kit
我正在从Google Places API检索数据。
index.html的body标签只有一个ion-nav-view,我想显示的地图是“ home”视图。这是我要添加标记的部分在离子含量内部的样子:
<ng-map center="{{googleMaps.lat}}, {{googleMaps.lon}}"
zoom="13"
disable-default-u-i="true">
</ng-map>
<marker
ng-if="googleMaps.isLoading === false"
icon="img/me-marker.png"
position="{{[googleMaps.lat,googleMaps.lon]}}"></marker>
<marker
ng-if="googleMaps.isLoading === false"
clickable="true"
on-mousedown="showStationDetail(event,station)"
ng-repeat="station in googleMaps.results"
icon="img/me-marker.png"
position="{{[station.geometry.location.lat,station.geometry.location.lng]}}">
</marker>
我将console.log语句放入“ GoogleController”和ng-if的标记中,以确保在添加标记之前初始化$ scope.map并填充结果数组:
$scope.$on('mapInitialized',function(event,map){
console.log('SCOPE.MAP INITIALIZED');
$scope.map = map;
});
有人可能会认为60个标记太多而无法添加,但是我什至无法使用我的科尔多瓦地理位置插件将单个标记添加到我自己的位置。
我试过使用ng-map.js而不是ng-map.min.js,不走运。
据我了解,“ addObject”是mapController的属性,而mapController为null?我是一个初学者,您可能为此而嘲笑我,但是我认为这是因为我没有使用index.html,而是使用了主视图(因为我是在Firebase社交身份验证入门工具包的顶部构建应用程序的),但是我不知道如何进行,我被困住了:/我试图通过开始一个新项目从头开始做所有事情,也没有运气。
可能是什么问题?我尝试了其他方法来实现Google Maps,但我得到的只是一个空白屏幕(即使我将宽度和高度调整为100%)。
抱歉,如果我有任何错误,这是我关于stackoverflow的第一个问题,我已尽力而为。
标记应在内部<ng-map>
:
<ng-map center="{{googleMaps.lat}}, {{googleMaps.lon}}"
zoom="13"
disable-default-u-i="true">
<marker
ng-if="googleMaps.isLoading === false"
icon="img/me-marker.png"
position="{{[googleMaps.lat,googleMaps.lon]}}"></marker>
<marker
ng-if="googleMaps.isLoading === false"
clickable="true"
on-mousedown="showStationDetail(event,station)"
ng-repeat="station in googleMaps.results"
icon="img/me-marker.png"
position="{{[station.geometry.location.lat,station.geometry.location.lng]}}">
</marker>
</ng-map>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句