Storing Function in json

147 Views Asked by At

I'm using ng2-smart-table library and need to apply a pipe against a row. The doc specifies to use a property valuePrepareFunction to store a function as such

settings = {
      columns: {
        buildQty: {
          title: 'buildQty'
        },
        created: {
          title: 'created',
          valuePrepareFunction: (created) => {
            return this.datePipe.transform(new Date(created), 'dd MMM yyyy');
          }
        },
        username: {
          title: 'User Name'
        },
        email: {
          title: 'Email'
        }
      },
    };

The problem I have is that this settings comming from my backend (Django rest framework). How can I store this exact same method as a json object?

0

There are 0 best solutions below