谷歌地图是不是在角应用工作 [英] Google map is not working in Angular App

查看:151
本文介绍了谷歌地图是不是在角应用工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面谷歌地图的code未在现场应用中使用Angularjs.locally当我上传到现场应用它不工作there.how解决这个它working.but工作?

index.html的

 < D​​IV CLASS =项项除法的风格=FONT-SIZE:18像素;>
                        < I类=图标离子地图>< / I> &安培; NBSP;
                        <一个NG点击=launchGoogleMaps()>位置图和LT; / A>
                    < / DIV>

app.js

  $ scope.launchGoogleMaps =功能(){
        VAR URL =htt​​p://maps.google.com/maps?ll=\"+$scope.temple.latitude+\",\"+$scope.temple.longitude;
intel.xdk.device.launchExternal(URL);
    }


解决方案

试试这个

  $ scope.launchGoogleMaps =功能(){
    VAR URL =htt​​p://maps.google.com/maps?ll=\"+$scope.temple.latitude+\",\"+$scope.temple.longitude;    document.addEventListener(intel.xdk.device.ready功能(){
        intel.xdk.device.launchExternal(URL);
    },假);}

此功能仅适用于事件处理程序中。所以你不能仅仅把它只要你喜欢。
请确保您还添加了英特尔XDK设备插件,在您的应用程序。

和最后但并非最不重要你应该 config.xml中添加此行,让应用午餐任何外部链接:<获得原产地=*/>

参考: https://cordova.apache.org/文档/ EN / 4.0.0 / guide_appdev_whitelist_index.md.html

Below code of google map is not working in live Application using Angularjs.locally it is working.but when I upload to the live App it is not working there.how to solve this?

index.html

<div class="item item-divider" style="font-size:18px;">
                        <i class="icon ion-map"></i> &nbsp;
                        <a ng-click="launchGoogleMaps()">Location map</a>
                    </div>

app.js

$scope.launchGoogleMaps=function(){
        var url = "http://maps.google.com/maps?ll="+$scope.temple.latitude+","+$scope.temple.longitude;
intel.xdk.device.launchExternal(url);
    }

解决方案

Try this

$scope.launchGoogleMaps=function(){
    var url = "http://maps.google.com/maps?ll="+$scope.temple.latitude+","+$scope.temple.longitude;

    document.addEventListener("intel.xdk.device.ready",function(){
        intel.xdk.device.launchExternal(url);    
    },false);

} 

This function only works inside event handlers. So you can’t just call it whenever you like to. Make sure you have also added Intel XDK Device plugin in your app.

And last but not the least You should add this line in config.xml to let the app lunch any external url: <access origin="*" />

Ref: https://cordova.apache.org/docs/en/4.0.0/guide_appdev_whitelist_index.md.html

这篇关于谷歌地图是不是在角应用工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆