Created
December 10, 2012 20:50
-
-
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.
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
/** | |
* @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