How to insert HTML code into a textarea?

0

I would like to know how I can put HTML code in a textarea, since I have a textarea that receives data from the DB dynamically by date filters. ex:

  <textarea maxlength="8000" rows="15" style="resize:none; width:100%">{{ctrl.VariavelDB}}</textarea>

I use AngularJS, the value of the variable would look like this:

ctrl.VariavelDB = "Lorem bla bla bla <b> negrito </b> bla bla bla <br> <h1> TESTE BAL BLA BLA </h1>"

As soon as it is inserted it shows the code, what do I do, can anyone help me?
Thank you in advance.

    
asked by anonymous 27.02.2018 / 19:32

2 answers

0

You will not be able to get the code to be interpreted within textarea , for this use a WYSIWYG editor . .

I recommend Quill .

    
27.02.2018 / 19:39
0

We usually do this with a <DIV> element.

It is possible to do with other HTML elements, such as <P> . Example: link

So, the element can receive an html, via javascript for example, with jquery (please see the notation similar to the angular):

$("#meuDiv").html("lorem <strong>ipsum</strong>.");
    
27.02.2018 / 20:00