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上運行。 :) –