Try like this assets/img/fondo.jpg
Angular is SAP, so to access images from assets folder, just like that
Try like this assets/img/fondo.jpg
Angular is SAP, so to access images from assets folder, just like that
Try specifying the path to the image as this:
background-image: url(~src/assets/img/fondo.jpg);
With the tilde annotation you are specifying the relative root path of the project, and this should compile correctly.
I have the problem that in angular before compiling the assets folder it is in one url and after compiling it is in another.
When I do ng build --prod
the project is compiled and the url of things changes. It is not a problem because I can do the project by sticking to dist, like the rest of the images, but if I want to play the scss the compiler if the project path does not match is not compiled, however if it is compiled I cannot have the second route
The path after ng build (and that i need)
background-image: url(./assets/img/fondo.jpg);
The path before compiling (the one I need to write to compile)
background-image: url(../../../assets/img/fondo.jpg);
In the HTML is not a problem because it can compiling if i have this:
<img src="./assets/img/banderaReinoUnido.png" class="d-block" style="width: 100%;" (click)="useLanguage('en')">
The [ngStyle] it doesn’t works too, any ideas?
Try
Noup, it compiles but not shown