Last active
August 29, 2015 14:03
-
-
Save abhilash0001/fff8b577125e05a21983 to your computer and use it in GitHub Desktop.
AngularJS | Inject HTML
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
/* | |
How do I inject HTML? | |
The simplest and the most flexible way is to create a filter. | |
*/ | |
angular.module('mfgapp') | |
.filter('to_trusted', ['$sce', function($sce){ | |
return function(text) { | |
return $sce.trustAsHtml(text); | |
}; | |
}]); | |
<aside id="sidebar" ng-bind-html="sidebar.content | to_trusted"></aside> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment