0
我已经集成角谷歌,地图为我的项目离子运行 - index.html中我有:uiGmapGoogleMapApi.then没有在Android
<script src="lib/lodash.min.js"></script>
<script src="lib/angular-google-maps.min.js"></script>
在我看来HTML我有:
<ion-view>
<ion-content controller="WeatherController">
<ui-gmap-google-map center='map.center' zoom='map.zoom'></ui-gmap-google-map>
</ion-content>
</ion-view>
在app.js我:
.config(function(uiGmapGoogleMapApiProvider) {
uiGmapGoogleMapApiProvider.configure({
key: 'mygmapskey',
v: '3.17',
libraries: 'weather,geometry,visualization'
});
});
里面的style.css我:
.angular-google-map-container { height: 400px; }
最后,我WeatherController里面我有:
angular.module('starter', ['ionic', 'uiGmapgoogle-maps']);
...
.controller("WeatherController", function ($scope, uiGmapGoogleMapApi) {
console.log('WeatherController');
uiGmapGoogleMapApi.then(function(maps) {
console.log('maps API loaded; creating map');
$scope.map = { center: { latitude: 45, longitude: -73 }, zoom: 8 };
});
});
当我运行离子发球,我得到了工作正常的浏览器一个不错的地图。当我在Android(仿真器或我的物理设备)上运行它时,WeatherController会实例化,但uiGmapGoogleMapApi.then永远不会触发。这是不是打算在设备上运行?我在网站上看不到多少提及。
这是最有趣的,我想知道这些语法之间的区别是什么。但是,它不会在Android上运行。 :) –