EVOLUTION-MANAGER
Edit File: ngBindHtml.html
<a href='https://github.com/angular/angular.js/edit/v1.3.x/src/ng/directive/ngBind.js?message=docs(ngBindHtml)%3A%20describe%20your%20change...#L139' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit"> </i>Improve this Doc</a> <a href='https://github.com/angular/angular.js/tree/v1.3.9/src/ng/directive/ngBind.js#L139' class='view-source pull-right btn btn-primary'> <i class="glyphicon glyphicon-zoom-in"> </i>View Source </a> <header class="api-profile-header"> <h1 class="api-profile-header-heading">ngBindHtml</h1> <ol class="api-profile-header-structure naked-list step-list"> <li> - directive in module <a href="api/ng">ng</a> </li> </ol> </header> <div class="api-profile-description"> <p>Evaluates the expression and inserts the resulting HTML into the element in a secure way. By default, the resulting HTML content will be sanitized using the <a href="api/ngSanitize/service/$sanitize">$sanitize</a> service. To utilize this functionality, ensure that <code>$sanitize</code> is available, for example, by including <a href="api/ngSanitize"><code>ngSanitize</code></a> in your module's dependencies (not in core Angular). In order to use <a href="api/ngSanitize"><code>ngSanitize</code></a> in your module's dependencies, you need to include "angular-sanitize.js" in your application.</p> <p>You may also bypass sanitization for values you know are safe. To do so, bind to an explicitly trusted value via <a href="api/ng/service/$sce#trustAsHtml">$sce.trustAsHtml</a>. See the example under <a href="api/ng/service/$sce#show-me-an-example-using-sce-">Strict Contextual Escaping (SCE)</a>.</p> <p>Note: If a <code>$sanitize</code> service is unavailable and the bound value isn't explicitly trusted, you will have an exception (instead of an exploit.)</p> </div> <div> <h2>Directive Info</h2> <ul> <li>This directive executes at priority level 0.</li> </ul> <h2 id="usage">Usage</h2> <div class="usage"> <ul> <li>as attribute: <pre><code><ANY ng-bind-html=""> ... </ANY></code></pre> </li> </div> <section class="api-section"> <h3>Arguments</h3> <table class="variables-matrix input-arguments"> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td> ngBindHtml </td> <td> <a href="" class="label type-hint type-hint-expression">expression</a> </td> <td> <p><a href="guide/expression">Expression</a> to evaluate.</p> </td> </tr> </tbody> </table> </section> <h2 id="example">Example</h2><p> <div> <a ng-click="openPlunkr('examples/example-example61')" class="btn pull-right"> <i class="glyphicon glyphicon-edit"> </i> Edit in Plunker</a> <div class="runnable-example" path="examples/example-example61" module="bindHtmlExample" deps="angular-sanitize.js"> <div class="runnable-example-file" name="index.html" language="html" type="html"> <pre><code><div ng-controller="ExampleController"> <p ng-bind-html="myHTML"></p> </div></code></pre> </div> <div class="runnable-example-file" name="script.js" language="js" type="js"> <pre><code>angular.module('bindHtmlExample', ['ngSanitize']) .controller('ExampleController', ['$scope', function($scope) { $scope.myHTML = 'I am an <code>HTML</code>string with ' + '<a href="#">links!</a> and other <em>stuff</em>'; }]);</code></pre> </div> <div class="runnable-example-file" name="protractor.js" type="protractor" language="js"> <pre><code>it('should check ng-bind-html', function() { expect(element(by.binding('myHTML')).getText()).toBe( 'I am an HTMLstring with links! and other stuff'); });</code></pre> </div> <iframe class="runnable-example-frame" src="examples/example-example61/index.html" name="example-example61"></iframe> </div> </div> </p> </div>