Skip to content

Instantly share code, notes, and snippets.

@ofca-snippets
Created December 10, 2012 20:50
Show Gist options
  • Save ofca-snippets/4253293 to your computer and use it in GitHub Desktop.
Save ofca-snippets/4253293 to your computer and use it in GitHub Desktop.
Angular ngHTML directive. This directive allow you to put raw HTML in a DOM element.
/**
* @example
* <span ng-html='foo.bar'></span>
*/
app.directive('ngHtml', function() {
return function(scope, element, attrs) {
scope.$watch(attrs.ngHtml, function(value) {
element[0].innerHTML = value;
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment