Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/371.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 事件响应中缺少Gmaps API获取latlng_Javascript_Angularjs_Google Maps - Fatal编程技术网

Javascript 事件响应中缺少Gmaps API获取latlng

Javascript 事件响应中缺少Gmaps API获取latlng,javascript,angularjs,google-maps,Javascript,Angularjs,Google Maps,我正在使用谷歌地图的Angular用户界面,并试图从点击地图的位置获取latlng。目前,map正在返回响应,但没有latlng。请参阅下面我的代码: 控制器 $scope.map = { center: { latitude: 45, longitude: -73 }, zoom: 8, events: { "click": function (event) { console.log(event.latlng); } } }; htm

我正在使用谷歌地图的Angular用户界面,并试图从点击地图的位置获取latlng。目前,map正在返回响应,但没有latlng。请参阅下面我的代码:

控制器

$scope.map = {
  center: {
    latitude: 45, longitude: -73
  },
  zoom: 8,
  events: {
    "click": function (event) {
      console.log(event.latlng);
    }
  }
};
html

如果你需要更多的代码,请告诉我


谢谢

事实证明,事件将以第三个参数的数组形式返回它,请参见下面的修复。我希望这对某人有所帮助:

$scope.map = {
  center: {
    latitude: 45, longitude: -73
  },
  zoom: 8,
  events: {
    "click": function (event, a, b) {
      console.log(a);
      console.log(b);

    }
  }
};
Ln {gm_bindings_: Object, __gm: Wh, gm_accessors_: Object, mapTypeId: "roadmap", center: df…}__e3_: Object__gm: Whbounds: undefinedcenter: dfcontrols: Array[14]data: ghfeatures: UgetOptions: function () {gm_accessors_: Objectgm_bindings_: ObjectmapDataProviders: "Map data ©2014 Google"mapTypeId: "roadmap"mapTypes: DgmapUrl: "http://maps.google.com/maps?ll=45,-73&z=8&t=m&hl=en-US&gl=US&mapclient=apiv3"overlayMapTypes: lgstreetView: Uhtilt: 0tosUrl: "http://www.google.com/intl/en-US_US/help/terms_maps.html"uiGmap_id: "4b1e4213-59cd-4016-baac-2aa2af44fe1a"zoom: 8__proto__: c
$scope.map = {
  center: {
    latitude: 45, longitude: -73
  },
  zoom: 8,
  events: {
    "click": function (event, a, b) {
      console.log(a);
      console.log(b);

    }
  }
};