Get started with ui-leaflet CDN

MIT licensed

UI-Leaflet is a UI library for integrating Leaflet maps into AngularJS applications.

Tags:
  • angularjs
  • javascript
  • directive
  • leaflet
  • angular-ui
  • cli

Stable version

Copied!

How to start using ui-leaflet CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with ui-leaflet CDN - cdnhub.io</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/leaflet/1.7.1/leaflet.css"/>
  <script src="https://cdn.jsdelivr.net/leaflet/1.7.1/leaflet.js"></script>
  <script src="https://cdn.cdnhub.io/ui-leaflet/1.0.3/ui-leaflet.min.js"></script>
  <style>
    #mapid { height: 400px; width: 100%; }
  </style>
</head>
<body>
  <div id="mapid"></div>
  <script>
    // Initialize a map in the "mapid" div, set the view to a given place and zoom
    var map = L.map('mapid').setView([51.505, -0.09], 13);

    // Add a marker to the map at the given point
    L.marker([51.5, -0.09])
      .addTo(map)
      .bindPopup('A marker popup!')
      .openPopup();

    // Use UI-Leaflet to create a popup with a custom UI
    L.popup()
      .setLatLng([51.505, -0.09])
      .setContent('<div><h3>Popup title</h3><p>Some content.</p></div>')
      .setClassName('my-custom-popup')
      .addTo(map);
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!

All versions