From 123366f886fc5d48d73c5091207c7a8895c004d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lombard?= Date: Mon, 12 Oct 2015 18:13:32 +0200 Subject: [PATCH] adds $compile to the "btfMarkdown" directive --- markdown.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/markdown.js b/markdown.js index 989a6be..016677c 100644 --- a/markdown.js +++ b/markdown.js @@ -18,7 +18,7 @@ angular.module('btford.markdown', ['ngSanitize']). } }; }). - directive('btfMarkdown', ['$sanitize', 'markdownConverter', function ($sanitize, markdownConverter) { + directive('btfMarkdown', ['$sanitize', 'markdownConverter', '$compile', function ($sanitize, markdownConverter, $compile) { return { restrict: 'AE', link: function (scope, element, attrs) { @@ -26,10 +26,12 @@ angular.module('btford.markdown', ['ngSanitize']). scope.$watch(attrs.btfMarkdown, function (newVal) { var html = newVal ? $sanitize(markdownConverter.makeHtml(newVal)) : ''; element.html(html); + $compile(element.contents())(scope); }); } else { var html = $sanitize(markdownConverter.makeHtml(element.text())); element.html(html); + $compile(element.contents())(scope); } } };