I created a filter in AngularJS 1.2, which uses ShowdownJS to parse Markdown content in HTML:
App.filter('markdown', function( $sce ) {
var converter = new Showdown.converter();
return function (value) {
var html = converter.makeHtml(value);
return $sce.trustAsHtml(html);
};
});
Template binding is done using ng-bind-html . This one gets the final HTML content, so it should display the content:
<div ng-bind-html="post.content | markdown"></div>
The filter works , but I get this error in the console because it returns the $ sce service , and MUST only return parsing > HTML string .
10 $digest() iterations reached. Aborting!
? - , html $sce.
EDIT: sanitize config, , .
$sceProvider.enabled(false);