angular-ui / ui-map

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

event $params returns an empty array #25

Closed louh closed 11 years ago

louh commented 11 years ago

I have an application set up in this way:

In the HTML, this is set up to call a function on the controller whenever a click event is triggered on the map:

<div id="map" ui-map="map" ui-options="mapOptions" ui-event="{'map-click': 'mapClick($event, $params)' }"></div>

Inside a controller, I have this:

$scope.mapClick = function ($event, $params) {

    // I want to get lat / lng from the click event
    // However, $params.latLng is undefined.
    $scope.mapService.clicked.lat = $params.latLng.lat()
    $scope.mapService.clicked.lng = $params.latLng.lng()

    // This returns an empty array [ ]
    console.log($params)
}

$params should be returning the normal Angular click event data, according to what I'm seeing in the examples here. Why would it be an empty array? I'm using Angular 1.1.5, if that makes a difference.

louh commented 11 years ago

This was solved by forcing the application to upgrade to 1.2.0-rc2 of Angular.