I'm trying to use the leatflet package in my Angular project but I can't get it to work.
I installed leatflet with npm install leatflet --save then I'm including the dependencies in the angular.json file:
"styles": [
"node_modules/leaflet/dist/leaflet.css",
],
"scripts": [
"node_modules/leaflet/dist/leaflet.js"
],
My app.component.ts file:
import { Component, OnInit } from '@angular/core';
import * as L from 'leaflet';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{
constructor() {}
ngOnInit() {
const myMap = L.map('map').setView([51.505, -0.09], 13);
}
onAdressSubmit(form) {
console.log(form.value.adress);
}
}
and inside the app.component.html I have a section with an id of map.
All I see is this:

Does someone know where the problem lies and how to fix it?
Help would be much appreciated. :)