Angular 4 img src is not found

后端 未结 16 1553
我寻月下人不归
我寻月下人不归 2020-12-24 10:11

I\'m having a problem with sourcing an image with angular 4. It keeps telling me that the image is not found.

Folder structure:

app_folder/
app_compo         


        
16条回答
  •  Happy的楠姐
    2020-12-24 10:42

    Well, the problem was that, somehow, the path was not recognized when was inserted in src by a variable. I had to create a variable like this:

    path:any = require("../../img/myImage.png");
    

    and then I can use it in src. Thanks everyone!

提交回复
热议问题