Skip to content

Instantly share code, notes, and snippets.

@shotaK
Forked from nelsonpecora/trusthtml.js
Last active October 10, 2015 16:10
Show Gist options
  • Save shotaK/8847d9f220a9eff71069 to your computer and use it in GitHub Desktop.
Save shotaK/8847d9f220a9eff71069 to your computer and use it in GitHub Desktop.
Custom filter to trust all html.
// WARNING: Use with caution. Don't use when displaying user-created content.
app.filter('html', ['$sce', function ($sce) {
return function(t) {
return $sce.trustAsHtml(t)
}
}]);
// Usage
<span ng-bind-html="yourDataValue | html"></span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment