angular-ui / ui-map

Google Maps
http://angular-ui.github.io/ui-map
MIT License
288 stars 93 forks source link

map-event binder not taking arguments #21

Closed facuferrari closed 11 years ago

facuferrari commented 11 years ago

When I try to place markers it returns me Cannot read property latLng of undefined.

<div ui-map="myMap" ui-options="mapOptions" ui-event="{ 'map-click' : 'addMarker($params)'}" class="map-canvas">

<div ng-repeat="marker in myMarkers" 
     ui-map-marker="myMarkers[$index]"
     ui-event="{'map-click': 'markerClicked(marker)'}">
</div>

//Module angular.module('Maptesting', ['ui.map', 'ui.event']) .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, $params) {
        $scope.myMarkers.push(new google.maps.Markers({
            map: $scope.myMap,
            position: $params.latLng
        }));
    };

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

}]);
facuferrari commented 11 years ago

Don't know what I've did but I've installed with bower and know it works perfectly. :)