forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular.directive.ng:selected.html
35 lines (35 loc) · 1.49 KB
/
angular.directive.ng:selected.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
34
35
<h1>angular.directive.ng:selected</h1>
<div class="angular-directive-ng-selected"><fieldset class="workInProgress"><legend>Work in Progress</legend>
This page is currently being revised. It might be incomplete or contain inaccuracies.</fieldset>
<h2>Description</h2>
<div class="description"><p>The HTML specs do not require browsers to preserve the special attributes such as selected.
(The presence of them means true and absence means false)
This prevents the angular compiler from correctly retrieving the binding expression.
To solve this problem, we introduce ng:selected.</p></div>
<h2>Usage</h2>
<div class="usage"><pre class="brush: js; html-script: true;"><ANY ng:selected="template">
...
</ANY></pre>
<h3>Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">template – {template} – </code>
<p>any string which can contain '{{}}' markup.</p></li>
</ul>
</div>
<h2>Example</h2>
<div class="example"><doc:example>
<pre class="doc-source">
Check me to select: <input type="checkbox" name="checked"><br/>
<select>
<option>Hello!</option>
<option id="greet" ng:selected="{{checked}}">Greetings!</option>
</select>
</pre>
<pre class="doc-scenario">
it('should select Greetings!', function() {
expect(element('.doc-example-live #greet').attr('selected')).toBeFalsy();
input('checked').check();
expect(element('.doc-example-live #greet').attr('selected')).toBeTruthy();
});
</pre>
</doc:example></div>
</div>