My requirement is to create the leaflet map in angular formly,but I am new to this formly
and I know how to use integrate the map with normal html in angular as below
map.component.ts
ngOnInit() {
const map = L.map('map').setView([51.509865,-0.118092], 10);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
}
map.component.html
<div id="map"></div>
map.component.css
div{
height: 500px;
width: 500px;
}
But,Now I have to place the leaflet map in angular formly, can anyone help me regarding this
you can create a custom component of leaflet map and use it wherever in your project:
LeafletMapComponent.html
LeafletMapComponent.css
LeafletMapcomponent.ts
Then for using it :
and in your ts file: