我无法在我的项目中包含以下任何库:
https://github.com/w8r/leaflet-area-select
https://github.com/heyman/leaflet-areaselect
任何方向/帮助将不胜感激!
答案 0 :(得分:0)
Step - 1
npm install --save leaflet leaflet-area-select
Step - 2
Add in angular.json under Scripts section
"scripts": [
"node_modules/leaflet/dist/leaflet.js",
"node_modules/leaflet-area-select/dist/Map.SelectArea.min.js"
]
Step - 3
Declare a variable with name L (Because L refers to Leaflet as $ refers to jQuery) in the component where you want to use SelectArea
i.e.
Declare var L: any;
Step - 4
Use variable L to get instance of SelectArea
i.e.
Console.log(L.Map.SelectArea)