2

I have a problem with angular translates useSanitizeValueStrategy. It does nothing regardless what configuration i use. I am using the async loader to load my translations. It is an ASP.net MVC web api project.

Things I did to make it work :

  • implemented ngSanitize
  • tried multiple configurations

  $translateProvider.useUrlLoader('api', {
                queryParameter: 'langId'
            })
                .registerAvailableLanguageKeys(['en', 'de'])
                .preferredLanguage('en')
                .fallbackLanguage('de')
        .useSanitizeValueStrategy('escape'); // tried every configuration I found

I also tried to seperate the useSanitizeValueStrategy like $translateProvider.useSanitizeValueStrategy('escape');

or tried to change the position of the command but this did not work either.

any suggestions why this does not work?

Chris
  • 65
  • 6

1 Answers1

0
$translateProvider.useSanitizeValueStrategy('escape');

Try above-given line into your application configuration where you configuring your angular-translate library. In above given an answer with Strategy escape. This will escape HTML in the translation. You can also find many options here.

NightOwl888
  • 55,572
  • 24
  • 139
  • 212
USS
  • 460
  • 4
  • 16