javascript - Rendering HTML as it appears in the database in to a view using AngularJS -
i using tinymce style content user saves database, example of user saving below:
<ol><li><em>this</em> <span style="text-decoration: underline;" data-mce-style="text-decoration: underline;">html</span> email <strong><span style="font-family: 'times new roman', times;">should</span></strong> <span style="font-family: tahoma, arial, helvetica, sans-serif;">contain</span> different <span style="font-family: arial, helvetica, sans-serif;">fonts</span> in weights lists , links...</li></ol> i using ng-bind-html display html content in view, however, appears stripping inline styles. here source browser:
<ol><li><em>this</em> <span>html</span> email <strong><span>should</span></strong> <span>contain</span> different <span>fonts</span> in weights lists , links...</li></ol> is there way in can keep these inline styles in view?
you try marking html trusted, passing in $sce, as:
yourapp.controller('somectrl', ['$scope', '$sce', function($scope, $sce) { $scope.some_html = $sce.trustashtml(some_html_content); }]);
Comments
Post a Comment