angular directive to convert ASCII or html codes in special characters in a textbox or text area

2k views Asked by At

Here is the challenge I am facing with angularJS text boxes. I want to auto convert all the HTML codes and HTML Name into special characters inside a text-box.

Suppose, {$sce.trustAsHtml('Tom & Jerry');} it should auto convert into "Tom & Jerry" inside the same text box. [fiddle example][1]

I tried using custom directives, $sce , ng-model-options but not able to get the required result. Hope you guys can help me out with it.

Thanks in advance :)

1

There are 1 answers

1
sujeet On

I just solved it .Try entering any special characters, ASCII codes or html codes in the text box.

<div ng-controller="MyCtrl">

{{value}}

fiddle here