How to serve up images in Angular2?

前端 未结 6 1942
遥遥无期
遥遥无期 2020-11-29 20:06

I am trying to put the relative path to one of my images in my assets folder in an image src tag in my Angular2 app. I set a variable in my component to \'fullImagePath\' an

6条回答
  •  醉话见心
    2020-11-29 20:50

    In angular only one page is requested from server, that is index.html. And index.html and assets folder are on same directory. while putting image in any component give src value like assets\image.png. This will work fine because browser will make request to server for that image and webpack will be able serve that image.

提交回复
热议问题