Search Posts

Ng2-smart-table using display images

I am using angular 4.

I need display images in ng2-smart-table.

I tried to this.

public input= '<img src="image" />';
 settings = {
    mode:"external",
    actions:{add:false,position:'right'},
    edit: {
      editButtonContent: '<i class="fa fa-pencil-square" aria-hidden="true"></i>',
      saveButtonContent: '<i class="ion-checkmark"></i>',
      cancelButtonContent:'<i class="ion-close"></i>',
    },
    delete: {
      deleteButtonContent: '<i class="fa fa-trash" aria-hidden="true"></i>',
      confirmDelete: true
    },
    columns: {

       category:{
        title: "Category",
        filter: true
       },
        productname:{
        title: "Product Name",
        filter: true
       },
       image:{
         title:'Image',
         type: 'html',
         valuePrepareFunction: (image) => { return this._sanitizer.bypassSecurityTrustHtml(this.input); },
         filter:false
       },
       status: {
        title: "Status",
        filter: true
      }
    }
  };

let scope=this;
scope.products.push({
    productname: index.P_TITLE,
    category: result.C_TITLE,
    status: index.P_STATUS,
    image:'example.com/product/'+index.P_IMAGES[0].URL ,
    id: index.id
})
scope.dataproducts = new LocalDataSource(scope.products);

index is i used API.It’s a JSON value.Everthing is work fine.But Images still not displayed.Why?

How can i display Images in ng2-smart-table.

Kindly advice me,

THanks.

Source: AngularJS

1 comment on Ng2-smart-table using display images

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.