2016-08-03 5 views
2

를 번역하고 그것은 나에게 올바른 다음 번역 Selbstständig을 제공합니다.어떻게 번역 서비스를 사용하고 난이</p> <pre><code>span(translate="translation_id") </code></pre> <p>처럼 독일어로 <code>self employed</code> 번역 AngularJS와 지시어를 번역 사용하고 필터

하지만 난 아래

$translate("translation_id").then (translation) -> 
    $scope.translation = translation 

같은 서비스를 변환과 같은 번역을했다하지만 이번에는 나에게 잘못 번역 Selbstst&#228;ndig을 제공합니다. 그리고 같은 문제는 번역 필터에 있습니다.

두 출력의 차이는 ä for &#228;입니다. 왜 번역 서비스 및 번역 지시문이 다른 문제와이 문제를 해결하는 방법을 보여줍니다.

+0

번역의 배열의 실제 가치는 무엇인가 발견이

$translate("translation_id").then (translation) -> $scope.translation = translation $scope.translation = decodeHtml($scope.translation) decodeHtml = (html) -> var txt = document.createElement("textarea"); txt.innerHTML = html; return txt.value; 

등의 반환 번역을 디코딩 할 수 있나요? –

+0

@ S.Baggy 실제 값은 Selbstständig입니다. –

답변

0

angular translate 지시문과 angular translate 서비스가 다르게 작동하는 이유를 알지 못합니다.

그러나 접근 방법이 내 문제를 해결했습니다.

각도 변환 서비스를 사용할 때 반환 된 번역을 직접 사용할 수 없습니다. 먼저 나는 내가 여기에 위의 방법 What's the right way to decode a string that has special HTML entities in it?