I am building my angular app with ng build --deploy-url="/foo/bar/"
and trying to display background images using css background: url("url");
, but in the browser's dev tool I see incorrect url when it is trying to get the image.
if I try with:
background: url("assets/img/img.svg")
or background: url("./assets/img/img.svg")
the request in the browser looks like:
http://localhost:38080/foo/bar/img.svg
So /assets/img/
disapears.
if I try with:
background: url("/assets/img/img.svg")
the request in the browser looks like:
http://localhost:38080/assets/img/img.svg
Which is kind of expected, but who knows I tried..
Any idea? Thanks in advance