我正在使用 angular-ui 和 ui-events 模块和 ui-map,但问题是事件绑定不起作用。
HTML
<div id="map"
ui-map="myMap"
ui-options="mapOptions"
ui-events="{'map-click': 'addMarker($event)'}"
class="map-canvas">
</div>
控制器
angular.module('myAppModule', ['ui.map'])
.controller('CtrlGMap', ['$scope', function($scope) {
$scope.mapOptions = {
center: new google.maps.LatLng(-54.798112, -68.303375),
zoom: 11,
mapTypeId: google.maps.MapTypeId.SATELLITE
};
$scope.myMarkers = [];
$scope.addMarker = function($event) {
$scope.myMarkers.push(new google.maps.Marker({
map: $scope.myMap,
position: $params[0].latLng
}));
};
}]);
我知道 ui-map 加载 ui-events 模块。但是当我点击地图时没有任何反应:(