• Library contains contents . Each content contains tags. One tag may link to many contents.

  • Whenever use clicks particular tag i need to display contents. After clicking contents I am trying to display related documents.

  • In the code,passing content document Id for displaying documents but itsnot working.

Approach followed:

  • Even I have tried passing Content version Id also its still not working
  • Tried with Community url also
  • Getting broken image in my case (trying for Community)

     <aura:component  implements="forceCommunity:availableForAllPageTypes" 
        <aura:attribute name="id" type="Id"/> 
          <aura:attribute name="ContentIds" type="Id" 
       <aura:attribute name="prefixURL" type="String" 
     <img src="{!v.prefixURL+v.ContentIds}" width="100" height="100"/>

I referred below stack exchange code, tried in my org its working for both community & app builder

Display an image stored in ContentDocument (in lightning experience)

Problem in the code: If attachment is pdf,itsnot working!!


I got a solution finally.

Using lightning Tile card it works

 <lightning:fileCard fileId="{!v.ContentdocIds}"/>

Here ContentdocIds - ContentDocumentId

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.