ngmap
Version:
The Simplest AngularJS Google Maps V3 Directive
33 lines (32 loc) • 908 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 = app || angular.module('myApp', ['ngMap']);
app.controller('LayerDataQuakesSimpleCtrl', function($scope) {
$scope.styleFunc = function(feature) {
var mag = Math.exp(parseFloat(feature.getProperty('mag'))) * 0.1;
return /** @type {google.maps.Data.StyleOptions} */({
icon: {
path: google.maps.SymbolPath.CIRCLE,
scale: mag,
fillColor: '#f00',
fillOpacity: 0.35,
strokeWeight: 0
}
});
};
});
</script>
</head>
<body>
<div ng-controller="LayerDataQuakesSimpleCtrl as vm">
<ng-map zoom="3" center="20, -160">
<map-data set-style="vm.styleFunc"
load-geo-json="scripts/quakes.geo.json"></map-data>
</ng-map>
</div>
</body>
</html>