0

I am trying to output some HTML which is working fine, for the most part but some of the styling is being stripped out. From the images below you can see that the /ul/ is working fine and rendering the /li/ items fine in ng-repeat but the BOLD font is not coming down.

I've tried changing the styles and putting it within header tags and paragraphs but the font-weight doesnt work.

Any reason why?

1

2

3

Brad Martin
  • 5,637
  • 4
  • 28
  • 44

1 Answers1

1

Your input is being sanitized by ng-bind-html and it's stripping out your style tags. If you want the style tags to remain, you'll need to explicitly trust the html snippet.

$scope.deliberatelyTrustDangerousSnippet = function(snippet) {
  return $sce.trustAsHtml(snippet);
};

Then

<span ng-bind-html="deliberatelyTrustDangerousSnippet(news.Text)"></span>

Check out the example in the angular docs.

Joe
  • 2,596
  • 2
  • 14
  • 11