angularjs - ngBindHtml different result than $sce.parseAsHtml in template that uses angularUI -
edit: solution found! see bottom of question explanation.
i have directive sfngfieldwrapper contains tooltip got angularjui ui-bootstrap.
the text of tooltip set tooltip="{{ttptext}}"
.
the problem text contains html entities , these entities not translated correct character. can't use ng-bind-html i've checked , when use on span text tooltip correctly transformed. however, can't use span , ng-bind-html since need use tooltip.
to fix predicament thought use $sce.pareashtml
. problem html entities not correctly transformed characters!
i use in directive link function so:
scope.ttptext = $sce.parseashtml(scope.ttptext);
why doesn't parseashtml work while ng-bind-html does?
i can't put parseashtml inside scope.$watch because triggers loop.
trustashtml doesn't work either.
the tooltip function binds content so:
$document.find( 'body' ).append( tooltip );
solution
after looking code of ui-bootstrap started search stackoverflow , found question similar issue , solution! angular-ui tooltip html
stupid me have checked angularui guide: http://angular-ui.github.io/bootstrap/#/tooltip
the solution simple, can add -html-unsafe
after data-tooltip
.
solution
i updated question maximum visibility.
after looking code of ui-bootstrap started search stackoverflow , found question similar issue , solution! angular-ui tooltip html
stupid me have checked angularui guide: http://angular-ui.github.io/bootstrap/#/tooltip
the solution simple, can add -html-unsafe after data-tooltip.
Comments
Post a Comment