(EDIT: When you use plain Google Maps API with AngularJS Material the problem is the same.)
When I use at the same time in my AngularJS app:
- NgMap (https://github.com/allenhwkim/angularjs-google-maps)
- AngularJS Material (https://github.com/angular/material)
Maps don't work properly on mobile (on desktop it is ok) - the problem is with touch gestures. Example:
https://incampo.pl/map2.html - (test on mobile!)
but when I don't use material:
angular.module("incampoApp", ["ngMap"])
instead of:
angular.module("incampoApp", ["ngMap", "ngMaterial"])
it works properly: https://incampo.pl/map.html - (test on mobile!)
My whole example code (JS compiled from typescript):
<!DOCTYPE html>
<html ng-app="incampoApp">
<head>
</head>
<body ng-controller="offerController as vm">
<div map-lazy-load="https://maps.googleapis.com/maps/api/js?key=AIzaSyAyufiB6xUh1SzM7LK2NniXGDPyY__KtP8&callback=initMap">
<ng-map id="map" min-zoom="2" zoom="6" center="52.2,19"></ng-map>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.4/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.4/angular-aria.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.4/angular-messages.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.10/angular-material.min.js"></script>
<script src="//rawgit.com/allenhwkim/angularjs-google-maps/master/build/scripts/ng-map.min.js"></script>
<script>
var IncampoApp;
(function (IncampoApp) {
var OfferController = (function () {
function OfferController(ngMap) {
ngMap.getMap();
}
OfferController.$inject = ["NgMap"];
return OfferController;
}());
IncampoApp.OfferController = OfferController;
})(IncampoApp || (IncampoApp = {}));
</script>
<script>
var IncampoApp;
(function (IncampoApp) {
angular.module("incampoApp", ["ngMap", "ngMaterial"]).controller("offerController", IncampoApp.OfferController);
})(IncampoApp || (IncampoApp = {}));
</script>
</body>
</html>
Do you have any idea why?
Try this :
This solution may help you if want simple map in your html without (Google map key). Embed Google Map with iframe
I've found the solution here: https://github.com/angular/material/issues/11205
You just need to call $mdGestureProvider.skipClickHijack();