0

I am a beginner in Webview, trying to draw marker on a webview dynamically through $interval. I am using google map api v3 and following angular google map library ng-map.js:

<html style="overflow: auto !important;" ng-app="myApp">
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=weather,visualization,panoramio"></script>
<script src="JS/angular.min.js"></script>

<script src="JS/ng-map.min.js"></script>
<script>
 var app = angular.module('myApp', ['ngMap']);
 app.controller("PolylineComplexCtrl", function (NgMap, $interval, $scope) {

    $interval(function (position) {
        navigator.geolocation.getCurrentPosition(function (position) {

            new google.maps.Marker({
                position : {
                    lat : position.coords.latitude,
                    lng : position.coords.longitude
                },
                map : $scope.map,
                draggable : false,
                animation : google.maps.Animation.BOUNCE
            });
        });
    }, 1000);

    var vm = this;
    vm.path = [[41.879535, -87.624333]];
    vm.addMarkerAndPath = function (event) {
        vm.path.push([event.latLng.lat(), event.latLng.lng()]);
    };
 });
</script>
</head>

<body ng-controller="PolylineComplexCtrl as vm">
  <ng-map zoom="7" center="21.1500,79.0900" on-click="vm.addMarkerAndPath()">
    <shape name="polyline" id="foo"
      path="{{vm.path}}"
      stroke-color="#FF0000"
      stroke-opacity="1.0"
      stroke-weight="3">
    </shape>
  </ng-map>
</body>
</html>

Everything runs fine on browser but when I run it on a webview It doesn't work. What am I missing?

beaver
  • 17,333
  • 2
  • 40
  • 66
John
  • 478
  • 4
  • 12
  • 25

1 Answers1

0

Maybe you are facing problems to listen map click event on mobile, so I suggest to check these posts:

ng-map on-click doesn't work on mobile

how can i bind touch events for a marker in google maps?

Community
  • 1
  • 1
beaver
  • 17,333
  • 2
  • 40
  • 66