angular-ui / angular-google-maps

AngularJS directives for the Google Maps Javascript API
http://angular-ui.github.io/angular-google-maps
2.52k stars 1.07k forks source link

Marker in android #766

Open om3 opened 10 years ago

om3 commented 10 years ago

Hi, I can't get working the marker in android 4.4. The map is displayed correctly.

<script src='plugins_js/google-maps/lodash.js'></script>
<script src='plugins_js/google-maps/bluebird.js'></script>
<script src='plugins_js/google-maps/angular-google-maps.js'></script>
<script src="http://maps.googleapis.com/maps/api/js?libraries=weather,geometry,visualization,places&sensor=false&language=en&v=3.17"></script>
   $scope.map = {center: {latitude: 40.1451, longitude: -99.6680 }, zoom: 4 };
    $scope.options = {scrollwheel: false};
    $scope.coordsUpdates = 0;
    $scope.dynamicMoveCtr = 0;
    $scope.marker = {
      id: 0,
      coords: {
        latitude: 40.1451,
        longitude: -99.6680
      },
      options: { draggable: true },
      events: {
        dragend: function (marker, eventName, args) {
          $log.log('marker dragend');
          var lat = marker.getPosition().lat();
          var lon = marker.getPosition().lng();
          $log.log(lat);
          $log.log(lon);

          $scope.marker.options = {
            draggable: true,
            labelContent: "lat: " + $scope.marker.coords.latitude + ' ' + 'lon: ' + $scope.marker.coords.longitude,
            labelAnchor: "100 0",
            labelClass: "marker-labels"
          };
        }
      }
    };
    $scope.$watchCollection("marker.coords", function (newVal, oldVal) {
      if (_.isEqual(newVal, oldVal))
        return;
      $scope.coordsUpdates++;
    });
    $timeout(function () {
      $scope.marker.coords = {
        latitude: 42.1451,
        longitude: -100.6680
      };
      $scope.dynamicMoveCtr++;
      $timeout(function () {
        $scope.marker.coords = {
          latitude: 43.1451,
          longitude: -102.6680
        };
        $scope.dynamicMoveCtr++;
      }, 2000);
    }, 1000);       

<div id="map_canvas">
                        <ui-gmap-google-map center="map.center" zoom="map.zoom" draggable="true" options="options">
                            <ui-gmap-marker coords="marker.coords" options="marker.options" events="marker.events" idkey="marker.id">
                            </ui-gmap-marker>
                        </ui-gmap-google-map>
                        <div ng-cloak>
                            <ul>
                                <li>coords update ctr: {{coordsUpdates}}</li>
                                <li>dynamic move ctr: {{dynamicMoveCtr}}</li>
                            </ul>
                        </div>
                    </div>
ryanicle commented 10 years ago

I'm facing the same problem. Unable to show marker.

nmccready commented 10 years ago

I don't have the time to dedicate resources to figure out the mobile sector. There have been issues already submitted for mobile issues like clicking markers. Someone else needs to step up to the plate on this area.

alexgustafson commented 10 years ago

I can confirm markers are working on android 4.2

I'm testing on Android 4.2. using angular-google-maps v 2.0.6. in an ionic project. My markers are displaying fine.

loading scripts in this order:

 <script src="lib/ionic/js/ionic.js"></script>
 <script src="lib/jquery/dist/jquery.js"></script>
 <script src="lib/angular/angular.js"></script>
 <script src="lib/ionic/js/ionic-angular.js"></script>
...other libraries and modules...
 <script src="lib/lodash/dist/lodash.min.js"></script>
 <script src="lib/bluebird/js/browser/bluebird.js"></script>
 <script src="lib/angular-google-maps/dist/angular-google-maps.js"></script>
..my app and controllers here ...

Google libraries are loaded async via the new 2.0 feature. Clicks on the markers open the window element ( pop up thingy ) .

.. click on the windows does not do anything in android 4.2.. other platforms are ok..

nmccready commented 10 years ago

Please check out this as well #818

lfreneda commented 8 years ago

same problem here, any ideas?