diff --git a/src/diff.filter.js b/src/diff.filter.js
index 5d72d1a..3621067 100644
--- a/src/diff.filter.js
+++ b/src/diff.filter.js
@@ -1,7 +1,7 @@
'use strict';
angular.module('diff', [])
- .filter('diff', function () {
+ .filter('diff', function ($sce) {
/*
* Javascript Diff Algorithm
@@ -173,6 +173,6 @@ angular.module('diff', [])
// Actual filter
return function(input, match) {
- return diffString(input, match);
+ return $sce.trustAsHtml(diffString(input, match));
};
});
diff --git a/tests/diff.filter.js b/tests/diff.filter.js
index 0c9b35f..7da4595 100644
--- a/tests/diff.filter.js
+++ b/tests/diff.filter.js
@@ -9,7 +9,8 @@ describe('filter', function() {
it('should convert a string to the diff value with another string', inject(function(diffFilter) {
expect(diffFilter(
'The red brown fox jumped over the rolling log.',
- 'The brown spotted fox leaped over the rolling log')).toBe(
+ 'The brown spotted fox leaped over the rolling log')
+ .$$unwrapTrustedValue()).toBe(
' The red brown spotted fox jumped leaped over the rolling log.\nlog\n');
}));
});