Info about my Angular version:
Angular CLI: 7.3.9
Node: 10.15.3
OS: win32 x64
Angular: 7.2.15
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Issue that I'm facing is:
In dev build/environment:
Images in Angular's assets folder does not appear.
When you check the path it shows up as "http://localhost:4200/assets/sample.jpg" with HTTP error 404 (Not Found).
In HTML template it is written as
<img width="300" alt="Angular Logo" src="assets/sample.jpg">
sample.jpg lies in this folder myapp/src/assets/sample.jpg
In prod build/environment:
assets folder does not get compiled and generated in the dist folder itself hence, it does not appear here as well.
This is the case with even a fresh project generated from Angular CLI. This also happens with the favicon.
This is my assets array under build and test in angular.json.
"assets": [
"src/favicon.ico",
"src/assets"
],
I verified my file name and path.
Tried creating a couple of isolated projects on the same machine.
PS:
Now I'm starting to doubt whether it is due to some machine restriction. I'm working on a machine with limited user access setup. Could this be the reason? Any system level restriction can prevent images from loading?