Have setup an angular app using the angular CLI and have created a component that has an image in the components directory.
For example:
app/
---/common-components
------/header
---------/header.component.ts
---------/header.component.css
---------/images
--------------/image.png
Within the CSS file I am using the following style:
.image {
background-url: url('images/image.png');
}
When I run the application it gives me a 304 Not Modified and the image does not show up int he preview. If I use an absolute path '/src/app/common-components/header/images' the file loads properly. However, this is not ideal since I would like the component to be self sufficient.
The response that is given is:
Request URL:http://localhost:4201/images/test-image.jpeg
Request Method:GET
Status Code:304 Not Modified
Remote Address:127.0.0.1:4201
With a blank preview
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…