[SalesForce] How to load an image in lightning without including the namespace

I'm trying to include an image that I loaded as a static resource in a Lightning component. The image doesn't show up if I don't include my namespace. For example, this won't work:

<img src="/resource/FFPsa" />

However, if I include my namespace, it will:

<img src="/resource/abehrmandev210__FFPsa" />

How can I use the image without using my namespace?

For those not doing managed development, wouldn't this also cause issues with static resource caching? URLFOR in visualforce adds a cache buster to the path to prevent stale data, but it seems lightning has so such facility. Is this right?

Best Answer

This has been solved with Summer 16 release now .

<aura:component>
<!-- Stand-alone static resources -->
<img src="{!$Resource.generic_profile_svg}"/>
<img src="{!$Resource.yourNamespace__generic_profile_svg}"/>

<!-- Asset from an archive static resource -->
<img src="{!$Resource.SLDSv1 + '/assets/images/avatar1.jpg'}"/>
<img src="{!$Resource.yourNamespace__SLDSv1 + '/assets/images/avatar1.jpg'}"/>

Related Topic