thomas
thomas

Reputation: 1453

Angular filter for HTML formatting

Is there an existing angular filter for making JSON data appear as formatted HTML?

JSON data from a controller:

{ data: 'This data is <b>bold</b>' }

HTML:

<div>{{data | someKindOfFormatFilter }}</div>

Wanted result:

This data is bold

Upvotes: 2

Views: 267

Answers (1)

thomas
thomas

Reputation: 1453

I ended up doing as SameerK suggested, to use ngSanitize and ng-bind-html

var app = angular.module('app', ['ngSanitize']);

Answered in this post: How to output html through AngularJS template?

Upvotes: 1

Related Questions