Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

best practice? where to store an image in angular? [closed]

Tags:

angular

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.

like image 832
the chad Avatar asked Dec 05 '17 14:12

the chad


People also ask

Where should I put images in angular?

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.


1 Answers

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.

like image 91
Suhel Avatar answered Oct 17 '22 15:10

Suhel