gpt4 book ai didi

angularjs - 未捕获的 TypeError : Object [object global] has no method 'onGoogleReady' using angular-ui's ui. 映射到 Angular.js

转载 作者:行者123 更新时间:2023-12-02 03:42:36 25 4
gpt4 key购买 nike

我正在尝试使用 angular-ui's ui-map使用 Angular.js 库并收到错误

"Uncaught TypeError: Object [object global] has no method 'onGoogleReady' using ui.maps 和 Angular.js".

我知道我需要包括:

function onGoogleReady() {
angular.bootstrap(document.getElementById("map"), ['app.ui-map']);
}

但是在哪里以及如何?

最佳答案

 function initCall() {
console.log("Google maps api initialized.");
angular.bootstrap(document.getElementById("map"), ['doc.ui-map']);
}

angular.module('doc.ui-map', ['ui.map', 'prettifyDirective'])
.controller('MapCtrl', ['$scope', function ($scope) {

$scope.myMarkers = [];

$scope.mapOptions = {
center: new google.maps.LatLng(35.784, -78.670),
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
};

$scope.addMarker = function ($event, $params) {
$scope.myMarkers.push(new google.maps.Marker({
map: $scope.myMap,
position: $params[0].latLng
}));
};

$scope.setZoomMessage = function (zoom) {
$scope.zoomMessage = 'You just zoomed to ' + zoom + '!';
console.log(zoom, 'zoomed');
};

$scope.openMarkerInfo = function (marker) {
$scope.currentMarker = marker;
$scope.currentMarkerLat = marker.getPosition().lat();
$scope.currentMarkerLng = marker.getPosition().lng();
$scope.myInfoWindow.open($scope.myMap, marker);
};

$scope.setMarkerPosition = function (marker, lat, lng) {
marker.setPosition(new google.maps.LatLng(lat, lng));
};
}]) ;

来源: Demo.js

关于angularjs - 未捕获的 TypeError : Object [object global] has no method 'onGoogleReady' using angular-ui's ui. 映射到 Angular.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19166633/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com