TypeError:无法读取属性' ready'未定义的

时间:2017-02-23 00:19:53

标签: javascript cordova ionic-framework

好吧,我完全放弃了,我在最后2个小时就已经放弃了,我无法理解为什么它不起作用。

我补充说:

cordova plugin add cordova-plugin-geolocation
cordova plugin add cordova-plugin-whitelist

另外:

<!-- cordova script (this will be a 404 during development) -->
<script src="js/ng-cordova.min.js"></script>
<script src="cordova.js"></script>

我添加了我的游戏:

angular.module('starter', ['ionic', 'ngCordova', 'firebase', 'starter.controllers', 'starter.configs', ])

.run(function($ionicPlatform, $timeout) {
  $ionicPlatform.ready(function() {

    console.log('Platform ready!');

    if(window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }
  });
})

我的控制员:

$ionicPlatform.ready(function() {    

        $ionicLoading.show({
            template: '<ion-spinner icon="bubbles"></ion-spinner><br/>Acquiring location!'
        });

        var posOptions = {
            enableHighAccuracy: true,
            timeout: 20000,
            maximumAge: 0
        };

        $cordovaGeolocation.getCurrentPosition(posOptions).then(function (position) {
            var lat  = position.coords.latitude;
            var long = position.coords.longitude;

            var myLatlng = new google.maps.LatLng(lat, long);

            var mapOptions = {
                center: myLatlng,
                zoom: 16,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };          

            var map = new google.maps.Map(document.getElementById("map"), mapOptions);          

            $scope.map = map;   
            $ionicLoading.hide();           

        }, function(err) {
            $ionicLoading.hide();
            console.log(err);
        });
    })

无论我做什么,从离子发布,查看或构建Android,我都会得到同样的错误: TypeError:无法读取属性&#39; ready&#39;未定义的

编辑:这是我的控制人员的负责人:

.controller('businessPageController',['$scope', '$timeout', '$firebaseArray', 'CONFIG', '$document', '$state',   function($scope, $timeout, $firebaseArray, CONFIG, $document, $state, $cordovaGeolocation, $ionicLoading, $ionicPlatform, ionicPlatform, ngCordova)

我错过了什么?

1 个答案:

答案 0 :(得分:0)

已解决!

好吧,如果你是Javascript和Angular中的NOOB,就像我一样,你发现这篇文章,这是我刚刚找到的解决方案,可能在每个Javascript / Angular书的每一章中都有:

在编写控制器的功能时,必须在控制器中按照外观放置它们!

所以这就是我所拥有的:

getForwardIP

以下是有待写的:

import gzip


def getForwardIP(client_ip, request_ids):
    request_ids = set(request_ids)  # to get O(1) lookup
    with gzip.open("xyz.log") as infile:
        for lines in infile:
            line = lines.split(" ")
            found_request_id = line[0]
            found_forward_ip = line[1]
            if found_request_id in request_ids:
                print found_forward_ip


if __name__ == "__main__":
    request_id_list = list()
    # request_id_list contains >1000 elements
    getForwardIP("1.2.3.4.", request_id_list)