• Rishabh Kumar 27
  • 5 Points
  • Member since 2018

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1

I'm currently struggling with Lightning Component Framework Specialist Challenge 10.

I'm successfully using an event to pass values into the Map's client side controller, and Leaflet seems to be doing something, but:

1. The marker is displayed on a grey area, not a map.
2. When I click a second boat, instead of updating the map, an error pops up informing me "Uncaught Action failed: c:Map$controller$onPlotMapMarker [Map container is already initialized.]"

This is my onPlotMapMaker method:
onPlotMapMarker: function(component, event, helper) {
    	var id = event.getParam('sObjectId');
    	var lat = event.getParam('lat');
    	var long = event.getParam('long');
    	var label = event.getParam('label');

    	var mapContainer = component.find('map').getElement(); 
	    var map = L.map(mapContainer).setView([lat, long], 13);

		L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
		    attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
		L.marker([lat, long]).addTo(map)

What's wrong with it?