Search code examples
angularproperty-binding

How to use the *ngFor=let value as html property value in angular 2


Im trying to use the value of {{facturaCE.cantidad / 1.16}} as property value of data-clipboard-text = facturaCE.cantidad / 1.16

This is a fragment of my code

<tr *ngFor="let facturaCE of facturasClientesExistentes">
<td>{{facturaCE.cantidad}} --> {{facturaCE.cantidad / 1.16}}</td>
<td>{{facturaCE.cliente}}</td>
<td>{{facturaCE.correo}}</td>
<td>{{facturaCE.fecha}}</td>
<td>{{facturaCE.sucursal}}</td>
<td>
<button class="btn button" data-clipboard-text="I WANT TO USE HERE">Cantidad
</button>
<button (click)="facturaTerminada('clienteExistente', facturaCE)" class="button alert">Marcar como realizada
</button>
</td>
</tr>

I'm using Clipboard.js thats why have the property data-clipboard-text and it's working if I use some sample text.

Already try to use data-clipboard-text="{{facturaCE.cantidad / 1.16}}"


Solution

  • Use

    [attr.data-clipboard-text]=" facturaCE.cantidad / 1.16"

    Or

    attr.data-clipboard-text="{{facturaCE.cantidad / 1.16}}"