ngmap
Version:
The Simplest AngularJS Google Maps V3 Directive
29 lines (27 loc) • 800 B
HTML
<html ng-app="myApp">
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script src="script-tags-for-development.js"></script>
<script>
var app = angular.module('myApp', ['ngMap']);
app.controller("PolylineComplexCtrl", function(NgMap) {
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="41.879535, -87.624333" 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>