Reputation: 936
Build project in Angular7
.
After build through command ng-build --prod --base-href /client/product/v2/
deploy in vs folder, but folder structure is : www.domain.com/client/product/vs
All the images are in assets
folder and after build assets folder is in root.
After deployment, all the images
path are broken.
some images are ../../imagename.png
and some through css ../imagename.png
.
any idea how to fix this path issue? TIA
Upvotes: 2
Views: 6447
Reputation: 116
Fast foward to 2022, my problem and solution is as following:
Wrong way: using "../assets/something.png"
or "../../assets/something.png"
works fine with ng serve
, but not with ng build
, like this
<img src="../assets/something.png>
Right way: easily using "asset/someting.png"
works fine with both ng serve
and ng build
, like this
<img src="assets/something.png>
Upvotes: 3