2

I have an KEY which contains a string with a HTML tag: Foo <strong>bar</strong> and I'm using the angular translate service:

$translate('KEY').then(function(text) {
    $scope.text = text;
});

As output I get Foo <strong>bar</strong>, but I want to get 'Foo bar'. Is there are way to get this with the translate service?

I already set the sanitize strategy to sanitize, but even this does not help. I know that it works with the translate directive but it doesn't fit to my use case.

2 Answers 2

2

You can use the ngBindHtml directive:

<div ng-bind-html="text"></div>
Sign up to request clarification or add additional context in comments.

Comments

-1

You can also use $translateProvider.useSanitizeValueStrategy(param);

https://angular-translate.github.io/docs/#/guide/19_security

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.