I'm currently learning angular as I'm about to start a boat load of projects at work using it. Anyways, I'm just playing around with some stuff and I'm having some trouble figuring out the best place to store an image file. I've had success with the index.html file and the style.css setting a background image. But now I'm trying to use some pictures on the component level and just having some difficulty. Any advice would be greatly appreciated.
In angular2, images and other media are by default fetched from the assets directory within your project folder(all other directories of the project are not public to the components by default) this can be changed by modifying angular-cli. json.
If you want too many images in your application then upload your images to some server there lots of image servers out there. But if you have few images then you can store in
src/assets/images
folder. Access them directly by setting the path in image URL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With