angularjs - ng-html-bind omitting style tag -


i have ng-bind this

<p ng-bind-html="decodetext(item.description)"></p> 

with decodetext

$scope.decodetext = function (data) {     return data } 

however, following json loses style attribute style="color:#ff0000;" when rendered

[{"title":"i here","date_received":"feb 28, 2014","description":"<p>ee)\u00a0 <span style=\"color:#ff0000;\"> accepted<\/span><\/p>\n<p>hh)\u00a0 <span style=\"color:#ff0000;\">i am\nhere; <\/span><strong>\u00a0<\/strong><\/p>"} 

what's causing this?

ng-bind-html , $sce.trustashtml used displaying flat html.

it seems missing $sce part in code.

try instead:

$scope.decodetext = function (data) {     return $sce.trustashtml(data); } 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -