I have used this flow ex. flow (ui-template) in Dashboard 1.0, but can't get it to work in 2.0
- It loads the map, butif you refresh the page it goes black.
- Also need to remove the "scope", but then I can't find out to format the code in template so I can use "this.send"
Any help that I can get.
I have seen the YT videos over and over to see if I have missed out something.
Need more explaning of all the new stuff in ui-template 2.0
[{"id":"fd704f60baed6544","type":"ui_template","z":"0aaef064838ae5d3","group":"7e85723e91f540b8","name":"Leaflet","order":3,"width":12,"height":7,"format":"<link rel=\"stylesheet\" href=\"https://unpkg.com/leaflet@1.9.4/dist/leaflet.css\"\n integrity=\"sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=\" crossorigin=\"\" />\n<!-- Make sure you put this AFTER Leaflet's CSS -->\n<script src=\"https://unpkg.com/leaflet@1.9.4/dist/leaflet.js\"\n integrity=\"sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=\" crossorigin=\"\"></script>\n <style>\n #map {\n /*from www.java2s.com*/\n height: 500px;\n }\n \n .leaflet-grab {\n cursor: auto;\n }\n \n .leaflet-dragging .leaflet-grab {\n cursor: move;\n }\n </style>\n\n<script>\n (function() {\n const cScope = this.scope;\n setTimeout(function () {\n \n \tvar map = L.map('map').setView([48, 11], 10);\n let marker;\n \n \tL.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {\n \t\tmaxZoom: 20,\n attribution: '© OpenStreetMap'\n \t}).addTo(map);\n \t\n \tmap.on('click', function(e) {\n cScope.send(e.latlng);\n if (marker) {\n map.removeLayer(marker);\n };\n marker = L.marker(e.latlng).addTo(map);\n });\n \n setTimeout(function () {\n map.invalidateSize();\n }, 100);\n }, 300);\n })();\n</script>\n<div id=\"map\"></div>\n<!-- <div id=\"map\" style=\"width: 100%; height: 400px;\"></div> -->","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","className":"","x":650,"y":440,"wires":[["6dcbe4e3a0dd9739"]]},{"id":"7e85723e91f540b8","type":"ui_group","name":"iFrame","tab":"7ca1e2ce075bc580","order":3,"disp":true,"width":12,"collapse":false,"className":""},{"id":"7ca1e2ce075bc580","type":"ui_tab","name":"Home","icon":"dashboard","order":3,"disabled":false,"hidden":false}]
/ Ivan