aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNicolas Brugneaux2013-10-15 09:48:32 +0200
committerPete Bacon Darwin2013-10-24 22:11:56 +0100
commit93132b96bf149bcd53c9ae86b8115a522afc4119 (patch)
treeec83da885ffc916714f0902b4508073dab12dc5f /src
parentfaf5b980da09da2b4c28f1feab33f87269f9f0ba (diff)
downloadangular.js-93132b96bf149bcd53c9ae86b8115a522afc4119.tar.bz2
docs(ngBindHtml): add example
Closes #4427
Diffstat (limited to 'src')
-rw-r--r--src/ng/directive/ngBind.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ng/directive/ngBind.js b/src/ng/directive/ngBind.js
index 82ff505a..2ba50928 100644
--- a/src/ng/directive/ngBind.js
+++ b/src/ng/directive/ngBind.js
@@ -136,6 +136,29 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
*
* @element ANY
* @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate.
+ *
+ * @example
+ * Try it here: enter text in text box and watch the greeting change.
+ <doc:example module="ngBindHtmlExample" deps="angular-sanitize.js" >
+ <doc:source>
+ <script>
+ angular.module('ngBindHtmlExample', ['ngSanitize'])
+
+ .controller('ngBindHtmlCtrl', ['$scope', function ngBindHtmlCtrl($scope) {
+ $scope.myHTML = 'I am an <code>HTML</code>string with <a href="#">links!</a> and other <em>stuff</em>';
+ }]);
+ </script>
+ <div ng-controller="ngBindHtmlCtrl">
+ <p ng-bind-html="myHTML"></p>
+ </div>
+ </doc:source>
+ <doc:scenario>
+ it('should check ng-bind-html', function() {
+ expect(using('.doc-example-live').binding('myHTML')).
+ toBe('I am an <code>HTML</code>string with <a href="#">links!</a> and other <em>stuff</em>');
+ });
+ </doc:scenario>
+ </doc:example>
*/
var ngBindHtmlDirective = ['$sce', '$parse', function($sce, $parse) {
return function(scope, element, attr) {