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

后端 未结 5 1031
误落风尘
误落风尘 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:07

    Two things to note, first use brackets for the src property:

    
    

    Second, make sure the url of the image is relative to the url of the route that is used to display the component. Because this is generally not a great thing to do, I'd recommend making the url absolute from the root of the application:

    public heroImageUrl ="/ClientApp/app/components/home/image/employee_management.jpg";
    

    And then better yet, place it in a common location like /images/employee_management.jpg

提交回复
热议问题