알 수 있는 방법이 각도 및 각 변환하기에 문장열 처리할 수 있는 html 컨텐트입니다.
나는 '할 수 있다 = " add_card-title 오더할 < ",,, 좀 더 빨리 nowrap" > 추가하기에서는 now<, 카드, class = 스팬할 /span> ",' 으로, 내 랑 구체화하십시오. 내가 내 안에서 사용할 때, {{& # 39 add_card-title& p> 템플리트를 < 써서 '# 39;;; 저도 문자열이어야 <, /p> 변환하기에}}, '없다.
저도 ng html 바인딩하지 안전하지 않은 거들어야죠 사용할 수 있는 '아니다'
<p ng-html-bind-unsafe="{{'add_card-title' | translate}}"></p>
이를 방법은 없나?
이것은 내 프룬커: http://plnkr.co/edit/nTmMFm9B94BmbTgo2h8H? p = 미리봅니다
참고로 이 문제를 볼 수 있습니다. https://github.com/PascalPrecht/angular-translate/issues/173
곧바로 할 수 있는 [각 변환하기에 2.0] [1] 요즘.
<p translate="{{ 'PASSED_AS_INTERPOLATION' }}"></p>
불가사의 작동됨 가져다줄래요.
[1]: http://angular-translate.github.io/docs/ # /guide/05_using-translate-directive
이 방법은 나여야지 html 의 좋은 해설 스타일 (기울임꼴을 굵은꼴, 예를 들어, etc.)
<p translate="translationId"></p>
하지만 난 또 내가 wasn& 데 필요한 전략을 사용하여, t # 39 의 공급자입니다 이스케이프입니다 설정되었습니다. 나를 위해서 있는 엉망 귈이예요.
https://angular-translate.github.io/docs/ # /guide/19_security
사용: 각 변환하기에 v2.13.1
나는 솔루션이므로 찾았습니다. '내가 사용한' 앙굴라이스 v1.2.0-rc.3 ng html 바인딩하지 안전하지 않은 디스크입니다. diskid attaboy '' 더 이상 사용되지 않습니다. '지금' 대신 '각도' ng html 바인딩하지 안전하지 않은 html 바인딩하지 ng 있다. 하지만 [각 살균] [1] 에 dependency 를 투입할 수 있는 사람이 이해했소 작업 중.
내가 재장착하여
<p ng-html-bind-unsafe="{{'add_card-title' | translate}}"></p>
함께
<p ng-bind-html="'{{'add_card-title' | translate}}'"></p>
하고 일하기.
[1]: 3/angular-sanitize.js http://code.angularjs.org/1.2.0-rc
다음은 함께 사용할 수 있는 다양한 것가운데 html (함께 유효범위 com/go/4e6b330a_kr 인터프레션 함께 하는 경우 해당 html 같은 ng 를 번역):
http://plnkr.co/edit/OnR9oA? p = 미리봅니다
<div>{{'TESTING1_SIMPLE_VAR_REPLACE' | translate: '{name: "John Smith", username: "john.smith12"}'}}</div>
<div translate='TESTING1_SIMPLE_VAR_REPLACE' translate-values='{ name: "Jake Smith", username: "jake-smith-101" }'></div>
<div translate="TESTING1_SIMPLE_VAR_REPLACE_NA" translate-value-name="{{name}}" translate-value-username="{{username}}" translate-default="Hello {{name}} ({{username}})"></div>
<br/><br/>
<div>{{'TESTING1_SIMPLEHTML' | translate}}</div><!-- doesn't compile the html -->
<div translate="TESTING1_SIMPLEHTML" translate-default='DEFAULT(not used since there is a translation): This <b>translation</b> has a <a href="http://google.com" target="_blank">link</a>.'></div><!-- this and below compile the html -->
<div translate="TESTING1_SIMPLEHTML_NA" translate-default="DEFAULT(used since translation not available): This <b>translation</b> has a <a href='http://google.com' target='_blank'>link</a>."></div>
Uses ng-bind-html and sanitize: <div ng-bind-html="'TESTING1_SIMPLEHTML' | translate"></div>
<br/><br/>
<div translate="TESTING2_SCOPE" translate-values="{timer: timer}" translate-default="DEFAULT(not used since there is a translation): Seconds: <a href='http://google.com' target='_blank'>{{timer}} seconds</a>."></div>
<div translate="TESTING2_SCOPE" translate-value-timer="{{timer}}"></div>
<div translate="TESTING2_SCOPE_NA" translate-default="DEFAULT(used since translation not available): Seconds: <a href='http://google.com' target='_blank'>{{timer}} seconds</a>."></div>
<br/><br/>
<div compile-unsafe="'TESTING3_COMPILE' | translate"></div><!-- old way to do before angular 2.0-->
<div translate="TESTING3_COMPILE" translate-compile></div>
<div translate="{{'TESTING3_COMPILE_SCOPE'}}" translate-compile translate-value-name="{{name}}" translate-value-username="{{username}}" ></div> <!-- not sure of advantage of this style, but saw an example of it -->
<div translate="TESTING3_COMPILE_SCOPE" translate-compile translate-value-name="{{name}}" translate-value-username="{{username}}" ></div>
<div translate="TESTING3_COMPILE_SCOPE" translate-compile translate-values='{ name: "Jake Smith", username: "jake-smith-101" }' ></div>
"lng_pageFooter" : "Copyright © • 2018 • My Company • Powered by <a href=\"http://www.mycompany.com\">My Company™</a>"
...
$translateProvider.useSanitizeValueStrategy('escape');
....
app.filter('trusted', ['$sce', function($sce) {
var div = document.createElement('div');
return function(text) {
div.innerHTML = text;
return $sce.trustAsHtml(div.textContent);
};
}])
....
<span ng-bind-html="'lng_pageFooter' | translate | trusted"></span>
기본적으로 표시하고 앙굴라이스 이스케이프입니다 및 코드 안전상의 이유로 각 don& # 39 의 문장열 떠날려하면 합니다 있습니다 싶지 않다, 그 이전 앙굴라이스 1.2 배, 이스케이프입니다 전에 할 수 있는 '하지만' ng 바인딩하지 html 안전하지 않은 앙굴라이스 1.2 사용하는 개발자들은 더 이상 사용되지 않습니다.
Html 태그를 사용할 수 있는 '및' 에서 문장열 앙굴라이스 1.2+ 다운로드하십시오 각 살균 모듈에서는 애플리케이션 종속물과의 포함시켜야 합니다.
임의의 문자열 map_layer html 코드를 사용하여 자동으로 /dev/raw/raw1 html 바인딩하지 ng 살균, 표시할 수 있습니다 'it', '네 경우엔 $ # 39, & # 39 add_card-title& html 바인딩하지 ng = " 될 것이다. translate". '
참고:
[켜짐이 중간입니다] [1]
[앙굴라이스 문서용으로] [2]
[1]: # eb0e-33019fe608f4 https://medium.com/@yabasha/how-to-use-ngsanitize-e4b35459ecb0 [2]: $ 살균 (https://docs.angularjs.org/api/ngSanitize/service/)