Podcast/lib/angular/docs/partials/api/ng.directive:ngBindHtml.html
2013-08-21 19:46:51 +02:00

25 lines
2.2 KiB
HTML
Executable file

<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/directive/ngBind.js#L117" class="view-source btn btn-action"><i class="icon-zoom-in"> </i> View source</a><a href="http://github.com/angular/angular.js/edit/master/src/ng/directive/ngBind.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">ngBindHtml</code>
<div><span class="hint">directive in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-ngbindhtml-page"><p>Creates a binding that will innerHTML the result of evaluating the <code>expression</code> into the current
element in a secure way. By default, the innerHTML-ed content will be sanitized using the <a href="api/ngSanitize.$sanitize">$sanitize</a> service. To utilize this functionality, ensure that <code>$sanitize</code>
is available, for example, by including <a href="api/ngSanitize">ngSanitize</a> in your module&#39;s dependencies (not in
core Angular.) 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.$sce#trustAsHtml"><code>$sce.trustAsHtml</code></a>. See the example
under <a href="api/ng.$sce#Example"><code>Strict Contextual Escaping (SCE)</code></a>.</p>
<p>Note: If a <code>$sanitize</code> service is unavailable and the bound value isn&#39;t explicitly trusted, you
will have an exception (instead of an exploit.)</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage">as attribute<pre class="prettyprint linenums">&lt;ANY ng-bind-html="{expression}"&gt;
...
&lt;/ANY&gt;</pre>
as class<pre class="prettyprint linenums">&lt;ANY class="ng-bind-html: {expression};"&gt;
...
&lt;/ANY&gt;</pre>
<h4 id="parameters">Parameters</h4><table class="variables-matrix table table-bordered table-striped"><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><div class="ng-directive-page ng-directive-ngbindhtml-page"><p><a href="guide/expression">Expression</a> to evaluate.</p>
</div></td></tr></tbody></table></div>
</div>