Ionic 4 ion-textarea HTML


Previously, I was able to use the following to show html in a textarea:

<ion-textarea textarea id="article_text" class="article_text" type="text" placeholder="Article" [(ngModel)]="article" [innerHTML]="article" rows="20"></ion-textarea>

Where article could be something like: <b>Great Article!</b>

This no longer renders the html in Ionic 4.

Any suggestions on this? If the solution can get away from using innerHTML - all the better.


Did you include FormsModule and if needed ReactiveFormsModule in your page module?


I did not need to use a form at all, previously.
Do you think I need to put this in a form or just including the FormsModule would make this work?
I will try it.


FormsModule was in there and I added ReactiveFormsModule:

  imports: [
  declarations: [ArticlePage]

No change.


you do


any errors in the console?


Nope. No errors.
If I remove [(ngModel)]=“article” then I see nothing. With it, I see unrendered html.


what’s the purpose of textarea? did it help if you remove it?


I cannot recall if I actually needed in 3.9.2 for sure but there is a good chance. Maybe to get the innerHTML part to work.
But no change if removed.


weird…I’m out of idea sorry


Effort appreciated!
It renders in a regular div, so I will use that in the meanwhile.


I would consider the fact that this worked at all before to be a bug. I despise innerHTML, and wish it was deliberately dropped from Angular, but if what you are looking for is similar to what Discourse does with a preview function, I would implement it the same way. Separate the textarea where input happens, showing markup as markup, and have a separate element to display the rendered markup.