Xaverius
Xaverius

Reputation: 83

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}}"

Upvotes: 0

Views: 428

Answers (2)

Aravind
Aravind

Reputation: 41533

You should be using as below

<button class="btn button" attr.data-clipboard-text="{{facturaCE.cantidad/1.6}}">

LIVE DEMO

Upvotes: 0

Rehban Khatri
Rehban Khatri

Reputation: 954

Use

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

Or

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

Upvotes: 1

Related Questions