7

I need to use this editable column to display a "test" variable :

<td contentEditable="true" ngDefaultControl [(ngModel)]="test">{{test}}</td>

My td element displays the initial value of "test", but when I edit the td (using my keyboard), "test" does not change.

I have tested the same thing using input, and it works :

<input id="myinput" name="myinput" type="text" [(ngModel)]="test">

So what is the problem ?

BrainabilGH
  • 464
  • 5
  • 15

1 Answers1

5

I tried this :

<td contentEditable="true" [textContent]="test" (input)="test=$event.target.textContent">{{test}}</td>

And it works.

BrainabilGH
  • 464
  • 5
  • 15