Reputation: 1747
I am having an issue with encoding and decoding HTML Entities on a textarea using ngModel. The Back-End needs and is sending the ><"&'
as HTML Entities. This seems like it would be easy to do this, but for the life of me I can't think of a straight/safe way to do it.
I need to get the data from the Back-End and render the entities as normal text to the user.
On save - I need to send back to the back-end the special characters of ><"&'
as entities.
Bonus if there is a way to do a blanket on all special characters - not needed, but why not.
<textarea class="form-control" rows="5" id="comment" [(ngModel)]="employee.comments">
Upvotes: 1
Views: 2171
Reputation: 141
You can use innerhtml to load html content
<textarea class="form-control" rows="5" id="comment" [innerHtml]="employee.comments" [(ngModel)]="employee.comments">
you can refer this for more information.
Similar query answer. Alternative way NPM Package
Upvotes: 1