0

I'm unable to display the static resource Images in HTML by using LWC. Below is the file. Please guide me to fix this issue.

HTML

<lightning-card> <img src={profilePic}/> </lightning-card> 

JS File

  import { LightningElement,track } from 'lwc';
    import staticResourceImage from  '@salesforce/resourceUrl/Static_Images';
    export default class MyComponent extends LightningElement {
        profilePic = staticResourceImage+'/avatar.png' ;
    }

Static Resource: Static Resource Created

Static Resource Images

Image Error

Thanks in Advance,

1 Answer 1

0

remove /avatar.png update code as profilePic = staticResourceImage;

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.