forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular.directive.ng:bind.html
33 lines (32 loc) · 1.58 KB
/
angular.directive.ng:bind.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<h1>angular.directive.ng:bind</h1>
<div class="angular-directive-ng-bind"><h2>Description</h2>
<div class="description"><p>The <code>ng:bind</code> attribute tells Angular to replace the text content of the specified HTML element
with the value of a given expression, and to update the text content when the value of that
expression changes.</p>
<p>Typically, you don't use <code>ng:bind</code> directly, but instead you use the double curly markup like
<code>{{ expression }}</code> and let the Angular compiler transform it to
<code><span ng:bind="expression"></span></code> when the template is compiled.</p></div>
<h2>Usage</h2>
<div class="usage"><pre class="brush: js; html-script: true;"><ANY ng:bind="expression">
...
</ANY></pre>
<h3>Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">expression – {expression} – </code>
<p><a href="#!/guide/dev_guide.expressions">Expression</a> to evaluate.</p></li>
</ul>
</div>
<h2>Example</h2>
<div class="example"><p>Enter a name in the Live Preview text box; the greeting below the text box changes instantly.</p><doc:example>
<pre class="doc-source">
Enter name: <input type="text" name="name" value="Whirled"> <br>
Hello <span ng:bind="name"></span>!
</pre>
<pre class="doc-scenario">
it('should check ng:bind', function(){
expect(using('.doc-example-live').binding('name')).toBe('Whirled');
using('.doc-example-live').input('name').enter('world');
expect(using('.doc-example-live').binding('name')).toBe('world');
});
</pre>
</doc:example></div>
</div>