UNPKG

mohsen-angular-leaflet-directive

Version:

angular-leaflet-directive - An AngularJS directive to easily interact with Leaflet maps

47 lines (45 loc) 1.66 kB
<!DOCTYPE html> <html ng-app="demoapp"> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="../bower_components/angular/angular.min.js"></script> <script src="../bower_components/leaflet/dist/leaflet.js"></script> <script src="../dist/angular-leaflet-directive.min.js"></script> <link rel="stylesheet" href="../bower_components/leaflet/dist/leaflet.css" /> <script> var app = angular.module("demoapp", ["leaflet-directive"]); app.controller("GeoJSONController", [ '$scope', '$http', 'leafletData', function($scope, $http, leafletData) { angular.extend($scope, { japan: { lat: 38.51, lng: 139, zoom: 4 }, defaults: { scrollWheelZoom: false } }); // Get the countries geojson data from a JSON $http.get("json/JPN.geo.json").success(function(data, status) { angular.extend($scope, { geojson: { data: data, style: { fillColor: "green", weight: 2, opacity: 1, color: 'white', dashArray: '3', fillOpacity: 0.7 } } }); }); } ]); </script> </head> <body ng-controller="GeoJSONController"> <leaflet lf-center="japan" lf-geojson="geojson" lf-defaults="defaults" width="100%" height="480px"></leaflet> <h1>Simple GeoJSON example</h1> </body> </html>