user2167582
user2167582

Reputation: 6368

angular filtering decode characters

in angular, if

$scope.myStr = '™';

{{myStr}} yields '$trade;' instead of the TM mark, how would I solve this issue using a filter?

and in some cases, $amp;trade; also appears, so I would absolutely need a filter to run the procedures, and eventually I want to be able to {{}} the result without dom manipulation.

Upvotes: 0

Views: 688

Answers (1)

Langdon
Langdon

Reputation: 20063

You can use ngBindUnsafeHtml: http://jsfiddle.net/Xnp3J/

<div ng-app ng-controller="x">
    <span ng-bind-html-unsafe="myStr"></span>
</div>

-

function x($scope) {
    $scope.myStr = '&trade;';
}

Upvotes: 1

Related Questions