How to load image from src/images folder rather than from assets folder in angular 2 -
i'm new angular 2. i'm generating angular 2 project angular cli. if i'm keeping image within src/images
folder, showing 404 file not found in browser displaying image if in src/assets
folder.
what reason behind , how load image src/images folder..??
<div style="text-align:center"> <h1> welcome {{title}}! </h1> <img width="300" src="./images/img.jpg"> </div>
browser output link output
code snap source code snap
the angular-cli
generated .angular-cli.json
can found project configuration, use assets array in .angular-cli.json list files or folders want copy as-is when building project.
put files inside of assets
, use:
<img width="300" src="/assets/images/img.jpg">
Comments
Post a Comment