Last active
August 29, 2015 14:09
-
-
Save yoren/c885281713b45a39c746 to your computer and use it in GitHub Desktop.
Bypass sanitization for values you know are safe
This file contains 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
<h1>{{post.title}}</h1> | |
<div ng-bind-html="post.content | toTrusted"></div> |
This file contains 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
angular.module('app', ['ngRoute']) | |
// ... | |
.filter('toTrusted', ['$sce', function($sce) { | |
return function(text) { | |
return $sce.trustAsHtml(text); | |
}; | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment