Mayuresh Chavan
Mayuresh Chavan

Reputation: 29

Access images which are outside assets folder in angular 7

I am uploading image and putting it in assets folder in angular 7 dynamically. but when i try to preview the image , image is not getting displayed without restarting ng serve. Is there any way in which i can access the images outside of assets folder so that i dont need to restart the ng serve every time i upload new image.

ts:
export const IMAGE_PATH="/assets/";
HTML :
<div class="product-img">
        <img [src]="imageUrl+product.imageFileName">
</div>

Upvotes: 1

Views: 516

Answers (1)

Karthik karnan
Karthik karnan

Reputation: 19

Convert the image to base64 format and you can directly access in html file without the help of assets folder. For your reference you can check with the below link.

https://stackblitz.com/edit/angular-g9n9np?file=src%2Fapp%2Fapp.component.ts

Upvotes: 1

Related Questions