【腾讯云】云产品限时秒杀,爆款1核2G云服务器,首年99元

ionic中获取坐标方法

ionic中获取坐标的方法  

1.首相需要执行命令:

cordova plugin add cordova-plugin-geolocation
2.然后块级注入配置bower文件引入ngCordova

2.然后块级注入配置bower文件引入ngCordova

3.控制器中注入$cordovaGeolocation

4.获取坐标

         $cordovaGeolocation.getCurrentPosition({
              timeout: 10000,
              enableHighAccuracy: false
            }).then(function(position) {
              scope.selectText = position;
            }, function() {

            });

 


posted @ 2016-06-20 09:07  happenzh  阅读(469)  评论(0编辑  收藏  举报