You need to sign in to do that
Don't have an account?
Pratik Gangawane 7
Aura Specialist SuperBadge - Issue with Step 10.
Facing issue while saving Map.cmp as "Failed to save Map.cmp: resource Leaflet cannot be found in namespace .: Source". while completing challenge 10 for Aura specialist. Any help on the same will be apprec
component code is:
Map.cmp
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
<aura:attribute name="width" type="String" default="100%" />
<aura:attribute name="height" type="String" default="200px" />
<aura:attribute name="location" type="SObject"/>
<aura:attribute name="jsLoaded" type="boolean" default="false"/>
<ltng:require styles="{!$Resource.Leaflet + '/leaflet.css'}"
scripts="{!$Resource.Leaflet + '/leaflet-src.js'}"
afterScriptsLoaded="{!c.jsLoaded}" />
<aura:handler event="c:PlotMapMarker" action="{!c.onPlotMapMarker}"/>
<lightning:card aura:id="map" title="Current Boat Location">
<div style="{!'width: ' + v.width + '; height: ' + v.height}">
<div style="width:100%; height:100%" class="slds-align_absolute-center">Please make a selection</div>
</div>
</lightning:card>
</aura:component>
MapController.js
({
jsLoaded: function(component) {
component.set("v.jsLoaded", true);
},
onPlotMapMarker: function (component,event,helper) {
var location = component.get("v.location");
var locationData = {
sObjectId : event.getParam("sObjectId"),
lat : event.getParam("lat"),
long : event.getParam("long"),
label : event.getParam("label")
};
component.set("v.location", locationData);
}
})
component code is:
Map.cmp
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
<aura:attribute name="width" type="String" default="100%" />
<aura:attribute name="height" type="String" default="200px" />
<aura:attribute name="location" type="SObject"/>
<aura:attribute name="jsLoaded" type="boolean" default="false"/>
<ltng:require styles="{!$Resource.Leaflet + '/leaflet.css'}"
scripts="{!$Resource.Leaflet + '/leaflet-src.js'}"
afterScriptsLoaded="{!c.jsLoaded}" />
<aura:handler event="c:PlotMapMarker" action="{!c.onPlotMapMarker}"/>
<lightning:card aura:id="map" title="Current Boat Location">
<div style="{!'width: ' + v.width + '; height: ' + v.height}">
<div style="width:100%; height:100%" class="slds-align_absolute-center">Please make a selection</div>
</div>
</lightning:card>
</aura:component>
MapController.js
({
jsLoaded: function(component) {
component.set("v.jsLoaded", true);
},
onPlotMapMarker: function (component,event,helper) {
var location = component.get("v.location");
var locationData = {
sObjectId : event.getParam("sObjectId"),
lat : event.getParam("lat"),
long : event.getParam("long"),
label : event.getParam("label")
};
component.set("v.location", locationData);
}
})
replace line of code in
Map.cmp
<ltng:require styles="{!$Resource.Leaflet + '/leaflet.css'}"
scripts="{!$Resource.Leaflet + '/leaflet-src.js'}"
afterScriptsLoaded="{!c.jsLoaded}" />
with the following
<ltng:require styles="/resource/leaflet/leaflet/leaflet.css"
scripts="/resource/leaflet/leaflet/leaflet.js"
afterScriptsLoaded="{!c.jsLoaded}" />
and go for the superbadge :)