2

I am using angular 4 and is stuck at a point. I am using below code in html component to display data in a table:

<table class="table">
<thead>
    <tr>
      <th>Code</th>
      <th width="22%">Description</th>
      <th>Requested <br> Date</th>
      <th>Status</th>
      <th width="15%">Status change Date</th>
      <th width="10%">User ID</th>
      <th width="31%">Comments</th>
      <th></th>
    </tr>
</thead>
<tbody>
    <tr *ngFor="let orm of ormData">
      <td>{{orm.code}}</td>
      <td class="specialWidth">{{orm.description}}</td>
      <td>{{orm.reqDate}}</td>
      <td>{{orm.status}}</td>
      <td>{{orm.statusChngDate}}</td>
      <td>{{orm.userId}}</td>
      <td>{{orm.comments}}</td>
      <td><img src={{orm.img}} alt="delete" height=30px" width="30px"></td>
    </tr>
</tbody>

and this is the ormData from ts component:

ormData = [{
'code':'AP1',
'description':'AP Translated and attested by SM',
'reqDate':'29/11/2016',
'status':'pending',
'statusChngDate':'13/12/2016',
'userId':'User ID',
'comments':'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui ipsam in.',
'img':'assets/icons/deleteGrey.svg'

}];

Now in my output am getting all data as expected except for the image. Instead of the image text content <img src="assets/icons/deleteGrey.svg" alt="delete" height=30px" width="30px"> is being displayed.

Kindly let me know how can I get my image displayed in the output.

Bijay Singh
  • 819
  • 4
  • 14
  • 33

1 Answers1

3

You are missing "" at the height attribute,

 <td><img [src]='orm.img'  height="30px" width="30px">
 </td>

DEMO

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396