Set Image path on ASP.NET Core + Angular 2 template for Visual Studio

后端 未结 5 1030
误落风尘
误落风尘 2020-12-16 03:43

I need to add a static image as shown below.Can you tell me why I cannot show the image on home page as shown below ? i.e. It\'s not working.

Here I\'m using this AS

5条回答
  •  生来不讨喜
    2020-12-16 04:16

    Depending on what your setup is, you probably have to place the static data files in a ressource/assets folder.

    My setup places the root of my site in /src. I place angular files in the subfolder /src/app and if i want to link to images i place those in a subfolder of src called /src/assets. When linking those images, i simply write the path as if /src is the root, so linking to an image called employee_management.jpg would be in

    'assets/employee_management.jpg'
    

    I use the Angular CLI btw, which uses webpack to bundle it all.

提交回复
热议问题