When adding an image by nodejs in Angular project's assets folder Angular needs a rebuild to show the image by path, how can I get images without a rebuild?
Asked
Active
Viewed 549 times
1
-
Hi Arsen Galloghlyan, can you provide more information, for example what is your build process ? – dege Nov 09 '19 at 09:59
-
ng serve in Angular (or only ctrl+s in my editor to rebuild it automatically) – Arsen Galloghlyan Nov 09 '19 at 11:05
-
The images are successfully adding in the assets folder, but angular doesn't recognize them until I rebuild the project. – Arsen Galloghlyan Nov 09 '19 at 11:08
1 Answers
2
I suppose that you are talking about ng serve and not actual deployment.
The assets are meant to be static updated at build time (ng build or ng serve).
I would upload the images to a different directory outside of angular and fetch them from there in your angular app as is described at this link here

Athanasios Kataras
- 25,191
- 4
- 32
- 61
-
Yes I am talking about ng serve. And what about saving images in the database (base64). Is it a good practice? – Arsen Galloghlyan Nov 09 '19 at 11:00
-
Depends on usage. Databases were traditionally used but nowadays something like blob storage would make sense. CDN could also be used. Always depends on the case – Athanasios Kataras Nov 09 '19 at 11:16
-
I want to vote but I am still not allowed to vote because of my reputation (I'm new here :) ) – Arsen Galloghlyan Nov 09 '19 at 11:33