forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular.directive.ng:class-odd.html
38 lines (38 loc) · 1.21 KB
/
angular.directive.ng:class-odd.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
36
37
38
<h1>angular.directive.ng:class-odd</h1>
<h2>Description</h2>
<p>The <code>ng:class-odd</code> and <code>ng:class-even</code> works exactly as
<code>ng:class</code>, except it works in conjunction with <code>ng:repeat</code>
and takes affect only on odd (even) rows.</p>
<h2>Usage</h2>
<h3>In HTML Template Binding</h3>
<tt>
<pre>
<ANY ng:class-odd="expression">
...
</ANY>
</pre>
</tt>
<h3>Parameters</h3>
<ul>
<li><tt>expression:expression</tt>: to eval. Must be inside
<code>ng:repeat</code>.</li>
</ul>
<h2>Example</h2>
<doc:example>
<doc:source>
<ol ng:init="names=['John', 'Mary', 'Cate', 'Suz']">
<li ng:repeat="name in names">
<span ng:class-odd="'ng-format-negative'"
ng:class-even="'ng-input-indicator-wait'">
{{name}} &nbsp; &nbsp; &nbsp;
</span>
</li>
</ol>
</doc:source>
<doc:scenario> it('should check ng:class-odd and ng:class-even', function(){
expect(element('.doc-example-live li:first span').attr('className')).
toMatch(/ng-format-negative/);
expect(element('.doc-example-live li:last span').attr('className')).
toMatch(/ng-input-indicator-wait/);
});</doc:scenario>
</doc:example>