我有一个非常简单的页面,上面有离子卡,下面是我有谷歌地图的卡:
<ui-gmap-google-map center='map.center' zoom='map.zoom' dragging='false' options="map.options" scroll="false"></ui-gmap-google-map>
在我的style.css中,我具有地图配置的大小,如下所示:
.angular-google-map-container { height: 400px; }
并且在我的控制器中,我具有以下代码来初始化地图:
uiGmapGoogleMapApi.then(function(maps) {
$scope.map = { center: { latitude: $scope.lat,longitude: $scope.lng },
zoom:15,
options: {
zoomControl: true,
maxZoom:15,
minZoom:10,
draggable: false,
rotateControl: false,
scrollwheel: false,
streetViewControl: false,
disableDefaultUI: true,
mapTypeId:google.maps.MapTypeId.ROADMAP
}
};
});
在IOS上,一切正常。chrome浏览器也是如此。但是,当我在android上运行该应用程序时,有时会“不幸地停止”。特别是如果我在加载页面上的所有数据之前快速滚动。
不知道这种行为的稳定性如何,就像Google Maps +离子性能问题一样。
解决此问题的任何帮助都将非常有用。
在adb logcat中,我发现了以下内容:
F/libc (13733): Fatal signal 11 (SIGSEGV) at 0x00000005 (code=1), thread 13772 (myApp323408)
I/DEBUG ( 178): pid: 13733, tid: 13772, name: myApp323408 >>> com.ionicframework.myApp323408 <<<
W/ActivityManager( 529): Force finishing activity com.ionicframework.myApp323408/.MainActivity
W/InputDispatcher( 529): channel '22441548 com.ionicframework.myApp323408/com.ionicframework.myApp323408.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0xd
E/InputDispatcher( 529): channel '22441548 com.ionicframework.myApp323408/com.ionicframework.myApp323408.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
I/ActivityManager( 529): Process com.ionicframework.myApp323408 (pid 13733) has died.
W/InputDispatcher( 529): Attempted to unregister already unregistered input channel '22441548 com.ionicframework.myApp323408/com.ionicframework.myApp323408.MainActivity (server)'
I/WindowState( 529): WIN DEATH: Window{22441548 u0 id=0 com.ionicframework.myApp323408/com.ionicframework.myApp323408.MainActivity}
I/ActivityManager( 529): [TopPkgCurBat] NowPkgName[com.asus.launcher] Battery[39] TimeTick[1440510555542] OldPkgName[com.ionicframework.myApp323408]
I/cm.log.servpro( 1129): [Privacy]/ com.ionicframework.myApp323408 is not in contact list
I/KRCMD (16987): [MESSAGE] the exit process ok:com.ionicframework.myApp323408
D/LauncherLog( 927): AppsCustomizePagedView - syncAppsPageItems page: 5 index: 81 Item: myApp
完美地在离子作品中使用此地图!
https://github.com/allenhwkim/angularjs-google-maps
我完全删除了
<script src='lodash.min.js'></script>
and
<script src='angular-google-maps.min.js'></script>
删除了地图的html标记:
<ui-gmap-google-map center='map.center' zoom='map.zoom' dragging='false' options="map.options" scroll="false"></ui-gmap-google-map>
而是使用ngMap。使用很简单。
加载js文件:
<script src="http://maps.google.com/maps/api/js"></script>
<script src="http://rawgit.com/allenhwkim/angularjs-google-maps/master/build/scripts/ng-map.min.js"></script>
将ngMap添加到您的应用中:
var myApp = angular.module('myApp', ['ngMap']);
将地图标记添加到页面(例如):
<map center="41,-87" zoom="3"></map>
到目前为止,已经在3种不同的android设备上进行了测试,每种设备上约有10到15个项目,而且行为稳定,并且还具有不错的延迟加载功能!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句