Created
August 30, 2013 09:50
-
-
Save leon/6388221 to your computer and use it in GitHub Desktop.
Angular 1.2 workaround for ng-bind-html-unsafe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
angular.module('app').directive('ngBindHtmlUnsafe', function ($sce) { | |
return { | |
constrain: 'E', | |
link: function (scope, element, attr) { | |
scope.$watch($sce.parseAsHtml(attr.ngBindHtmlUnsafe), function(value) { | |
element.html(value || ''); | |
}); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No matter what I do, I end up with no content. Any idea what I'm doing wrong?
I tried many variations: