How to convert html to plain text in angularjs controller?

1k Views Asked by At

I am using ng-bind-html (with ngSanitize module) to display html as plain text in view. It is tied to the scope variable partyinfo.

<div class="panel panel-primary" ng-bind-html="partyinfo" contenteditable="false"></div>

How can I look at the same scope variable and convert to plain text on the controller side? Is there an equivalent way of doing ng-bind-html on controller side?

Thanks for any help.

1

There are 1 best solutions below

0
On

I am not sure to understand your question but you could try with $sanitize service:

$sce.trustAsHtml($scope.partyInfo);