Which image path to be used to show static images #1145

Closed
opened 2025-08-09 17:19:02 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @Sampath-Lokuge on 1/2/2017

Hi,

I need to show the static image on home page using this template. I have tried as shown below.But it is not working. When I asked this on Stackoverflow where they're saying to use assets folder. But I cannot see such thing on this template. So can you tell me how to handle static image with this template.If you can provide an example then it's highly appreciated.

I have put the question on Stackoverflow. But none of the solutions are working with this template.

\home\home.component.html

<img src="{{heroImageUrl}}" style="height:30px">

home.component.ts

import { Component } from '@angular/core';

@Component({
    selector: 'home',
    template: require('./home.component.html')
})
export class HomeComponent {

    public heroImageUrl ="./image/employee_management.jpg";
}

Error :

it says like this Failed to load resource: the server responded with a status of 404 (Not Found).May be a path issue.how can I give it correctly ? Image is there as shown below.

image

*Originally created by @Sampath-Lokuge on 1/2/2017* Hi, I need to show the static image on home page using this template. I have tried as shown below.But it is not working. When I asked this on Stackoverflow where they're saying to use `assets` folder. But I cannot see such thing on this template. So can you tell me how to handle static image with this template.If you can provide an example then it's highly appreciated. I have put the question on [**Stackoverflow**](http://stackoverflow.com/questions/41426787/which-image-path-to-be-used-to-show-static-image-in-angular-2). But none of the solutions are working with this template. **\home\home.component.html** `<img src="{{heroImageUrl}}" style="height:30px">` **home.component.ts** ``` import { Component } from '@angular/core'; @Component({ selector: 'home', template: require('./home.component.html') }) export class HomeComponent { public heroImageUrl ="./image/employee_management.jpg"; } ``` **Error :** it says like this Failed to load resource: the server responded with a status of 404 (Not Found).May be a path issue.how can I give it correctly ? Image is there as shown below. ![image](https://i.stack.imgur.com/HdwZc.jpg)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1145
No description provided.