简体   繁体   中英

How to access image file in assets folder? [angular 7]

I created an angular app with 'ng new my-app', folder structure is like so:

my-app
  |- e2e
  |- node_modules
  |- src
     |- assets
         |- images
             |- smile.jpg

How can I reach my image through the client with http://localhost:4200/images/smile.jpg ?

Try this way

If you want to open image from browser url then use this

http://localhost:4200/assets/images/smile.jpg

图片

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM