2017-09-26 3 views
1

tootltiptrusashtml도 사용하고 있지만 텍스트는 HTML로 파싱되지 않는 문자열로 표시됩니다.html 태그가 uib-tooltip에서 작동하지 않습니다.

HTML :

<label uib-tooltip="{{TooltipText}}" 
     tooltip-enable="!showEditHours" 
     for="IsAttested" 
     ng-class="{'Cursor_Auto': !showEditHours}">Text</label> 

컨트롤러 :

$scope.ad = { 'text': 'This attestation is editable only when the <b> Hours of the Accounting Firm of the Issuer </b> section has been enabled for edit. Please click on the Edit <b> Hours of the Accounting Firm of the Issuer </b> button.' }; 
$scope.TooltipTextAttestationFinalName = $sce.trustAsHtml($scope.ad.text); 

답변

0

당신은 두 가지 옵션이 있습니다.

첫 번째는 uib-tooltip-htmldocumentation에 따라 html 문자열로 평가되는 표현식을 사용하는 지시문을 사용하는 것입니다.

<label uib-tooltip-html="TooltipText" 
    tooltip-enable="!showEditHours" 
    for="IsAttested" 
    ng-class="{'Cursor_Auto': !showEditHours}">Text</label> 

다른 템플릿 경로로 확인하는 식을 취하는 uib-tooltip-template,이다이 당신을 위해 무엇을 찾고있는 아마.

+1

감사를보십시오. –

+0

이것 뒤에 이유는 무엇입니까 ?? –

+1

'uib-tooltip-html' 지시어는 각도 표현식을 입력으로 받지만'{{someVar}}'는 실제로 지시문을 지시문에 전달하기 전에 표현식을 평가하므로 지시문 만 get 문자열을 가져다가 다시 평가하려고합니다 실패합니다). 예를 들어,'$ scope.someVar = '이것은 문자열입니다.'라고 선언하고 이것을'uib-tooltip-html = '{{someVar}}' '처럼 전달하면 툴팁 지시문은 '$ string [ '이것은 문자열입니다']하지만 분명히 작동하지 않을 것입니다. 댓글에서 명확하게 설명하기가 약간 어렵습니다. :-) –

0

내가 다시 이유 덕분이었다 UIB - 도구 설명 - HTML 내부 표현을 사용했는데,이

<label uib-tooltip-html="{{TooltipText}}" 
     tooltip-enable="!showEditHours" 
     for="IsAttested" 
     ng-class="{'Cursor_Auto': !showEditHours}">Text</label 

컨트롤러에게

$scope.ad = { 'text': 'This attestation is editable only when the <b> Hours of the Accounting Firm of the Issuer </b> section has been enabled for edit. Please click on the Edit <b> Hours of the Accounting Firm of the Issuer </b> button.' }; 
$scope.TooltipTextAttestationFinalName = $sce.trustAsHtml($scope.ad.text); 
+0

제가 실제로 HTML을 사용할 때 전에는 아무 것도 나오지 않았습니다. –

관련 문제