ngmap
Version:
The Simplest AngularJS Google Maps V3 Directive
29 lines (27 loc) • 833 B
HTML
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script src="script-tags-for-development.js"></script>
<script>
angular.module('myApp',['ngMap']).controller('MyCtrl', function(NgMap) {
var vm = this;
vm.message = 'You can not hide. :)';
NgMap.getMap("map").then(function(map) {
vm.map = map;
});
vm.callbackFunc = function(param) {
console.log('I know where '+ param +' are. ' + vm.message);
console.log('You are at' + vm.map.getCenter());
};
});
</script>
</head>
<body ng-app="myApp" ng-controller="MyCtrl as vm">
NOTE: open console, then see the message from callback
<ng-map id="map" center='current-position'
geo-fallback-center="[40.74, -74.18]"
geo-callback="vm.callbackFunc('you')"
></ng-map>
</body>
</html>