0

How to use "innerHTML" in the "textarea" component? I do that but nothing works.

<textarea [innerHTML]="notebook.description"
    class="form-control" name="description" 
    style="height:320px"  [(ngModel)]='notebook.description' disabled>
</textarea>
Robert
  • 7,394
  • 40
  • 45
  • 64
user10149472
  • 5
  • 1
  • 3

1 Answers1

0

kind of workaround

in html

<textarea [innerHTML]="getInnerHTML(name)" cols="" rows=""></textarea>

and in .ts file

getInnerHTML(val){ return val.replace(/(<([^>]+)>)/ig,''); }

refer the same on https://stackblitz.com/edit/angular-hnwgad?file=src%2Fapp%2Fapp.component.html


//ignore below one

try using

<textarea [innerHtml]="note.description"></textarea>

or

<textarea [(ngModel)]="note.description"></textarea>

ravi
  • 1,127
  • 9
  • 10