So I just started a new project and I already have a folder with images inside I moved the folder into my project and now the folder it's under the folder src ( project/src/images ) now in my app.component.html i am using:
<img src = "../images/shared/logo.svg"
the logo.svg is located in shared folder that is in images folder (project/src/images/shared/logo.svg)
I used "../" at the start to go one folder back from app folder where app.component.html is located in..
anywayy when I am loading the page with npm start it wont load the photo/img/icon.. also in the console it says : logo.svg:1 GET http://localhost:4200/images/shared/logo.svg 404 (Not Found)
CodePudding user response:
By default Anular project structure has a dedicated folder src/assets where you should keep your image and other asset files. It's possible to configure assets folder in angular.json
"assets": ["src/favicon.ico", "src/assets"]
However the easist way to solve your problem is to move images folder to src/assets
<img src="assets/images/shared/logo.svg" />