You need to sign in to do that
Don't have an account?
\dev\null
Build a basic SVG Icon Component
Can anyone actually get this trailhead to work?
https://developer.salesforce.com/trailhead/project/slds-lightning-components-workshop/slds-lc-4
I've been trying to learn lightning / lds and maybe i'm missing something?
Component Code:
Error during init : Object doesn't support property or method 'replace'
Also, enabling debug on lightning components doesn't seem to make a difference, no error is thrown in console so I'm not sure really how to even find my JS in the console sources.
https://developer.salesforce.com/trailhead/project/slds-lightning-components-workshop/slds-lc-4
I've been trying to learn lightning / lds and maybe i'm missing something?
Component Code:
<aura:component > <aura:attribute name="class" type="String" description="CSS classname for the SVG element" /> <aura:attribute name="xlinkHref" type="String" description="SLDS icon path. Ex: /assets/icons/utility-sprite/svg/symbols.svg#download" /> <aura:attribute name="ariaHidden" type="String" default="true" description="aria-hidden true or false. defaults to true" /> </aura:component>Render code:
({ //Overwrite default render function for svg component render: function(component, helper){ var classname = component.get("v.class"); var xlinkhref = component.get("v.xlinkHref"); var ariaHidden = component.get("v.ariaHidden"); var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); svg.setAttribute('class', classname); svg.setAttribute('aria-hidden', ariaHidden); svg.innerHTML = '<use xlink:href="'+ xlinkhref +'"></use>'; return svg; } })App Code
<aura:application > <div class="slds"> <ltng:require styles="/resource/SLDS0120/assets/styles/salesforce-lightning-design-system-ltng.css" /> <span class="slds-icon__container slds-icon-standard-account"> <c:svg class="slds-icon" xlinkHref="/resource/SLDS0120/assets/icons/standard-sprite/svg/symbols.svg#account" /> <span class="slds-assistive-text">Account Icon</span> </span> </div> </aura:application>Error:
Error during init : Object doesn't support property or method 'replace'
Also, enabling debug on lightning components doesn't seem to make a difference, no error is thrown in console so I'm not sure really how to even find my JS in the console sources.
All Answers
Error during init : (value || "").replace is not a function
sooo, dunno ... can you make this example work?
I was also able to get the trailhead step to complete and get the points, but the code just won't actually run.