2

我正在使用 http://jsfiddle.net/xSPAA/371/

//Add the requried module 'angular-ui' as a dependency
angular.module('maptesting', ['ui.map','ui.event']);

function MapCtrl($scope) {
    var ll = new google.maps.LatLng(45, -73);
    $scope.mapOptions = {
        center: ll,
        zoom: 8,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    //Markers should be added after map is loaded
    $scope.onMapIdle = function() {
        if ($scope.myMarkers === undefined){    
            var marker = new google.maps.Marker({
                map: $scope.myMap,
                position: ll
            });
            $scope.myMarkers = [marker, ];
        }
    };

    $scope.markerClicked = function(m) {
        window.alert("clicked");
    };

}

plunker 显示谷歌地图。我需要显示用户将在文本框中输入的特定位置图。

我该怎么做?

我需要使用地理位置 API 吗?

任何人都可以提供示例代码或plunker吗?

4

1 回答 1

3

下面是工作示例:

http://www.victorshi.com/blog/post/Use-Geolocation-API-with-Angularjs

例子

还要检查以下网址:

http://www.benfarrell.com/2013/11/05/some-geolocation-and-google-mapping-services-in-angularjs/

谷歌位置服务

http://jsfiddle.net/mrajcok/pEq6X/

directive 'googlePlaces'
于 2014-03-11T06:33:45.903 回答