ngmap
Version:
The Simplest AngularJS Google Maps V3 Directive
43 lines (40 loc) • 1.08 kB
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('OverlaySymbolAnimateCtrl', function(NgMap, $interval) {
var vm = this;
NgMap.getMap().then(function(map) {
var count = 0;
var line = map.shapes.foo;
$interval(function() {
count = (count + 1) % 200;
var icons = line.get('icons');
icons[0].offset = (count / 2) + '%';
line.set('icons', icons);
}, 20);
});
});
</script>
</head>
<body>
<div ng-controller="OverlaySymbolAnimateCtrl as vm">
<ng-map zoom="5" center="20.291, 153.027" map-type-id="TERRAIN">
<shape name="polyline" id="foo"
icons="[{
icon: {
path: 'CIRCLE',
scale: 8,
strokeColor: '#393'
},
offset: '100%'
}]"
path="[[22.291, 153.027], [18.291, 153.027]]">
</shape>
</ng-map>
</div>
</body>
</html>