0

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

Xaverius
  • 83
  • 1
  • 5
  • 1
    I dont understand. `data-clipboard-text = "facturaCE.cantidad / 1.16"` is not working? – Suraj Rao Jan 16 '17 at 04:59
  • @suraj thanks for answer, but if just put the text `data-clipboard-text = "facturaCE.cantidad / 1.16"` the value is the same text. And if i surround with `{{ facturaCE.cantidad / 1.16 }}` I got an the next error _Can't bind to 'clipboard-text' since it isn't a known property of 'button'. (" {{facturaCE.sucursal}}_ – Xaverius Jan 16 '17 at 05:20
  • you need to user attribute binding..have a look at [this answer](http://stackoverflow.com/a/34542844/1160236) – HirenParekh Jan 16 '17 at 05:27

2 Answers2

1

Use

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

Or

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

Rehban Khatri
  • 924
  • 1
  • 7
  • 19
0

You should be using as below

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

LIVE DEMO

Aravind
  • 40,391
  • 16
  • 91
  • 110