aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. Envall2013-07-19 17:02:17 +0200
committerKen Sheedlo2013-07-24 15:37:10 -0700
commit52b8211fd0154b9d6b771a83573a161f5580d92c (patch)
tree426dfef5cffa01f320763a1bc5e92d165de0eb8e /src
parent0fcd1e3b1fa6244d02f08631d9ef81bf79996fab (diff)
downloadangular.js-52b8211fd0154b9d6b771a83573a161f5580d92c.tar.bz2
feat(ngRepeat): add $even and $odd props to iterator
Diffstat (limited to 'src')
-rw-r--r--src/ng/directive/ngRepeat.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ng/directive/ngRepeat.js b/src/ng/directive/ngRepeat.js
index b5fa60dd..7da67105 100644
--- a/src/ng/directive/ngRepeat.js
+++ b/src/ng/directive/ngRepeat.js
@@ -17,6 +17,8 @@
* | `$first` | {@type boolean} | true if the repeated element is first in the iterator. |
* | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. |
* | `$last` | {@type boolean} | true if the repeated element is last in the iterator. |
+ * | `$even` | {@type boolean} | true if the iterator position `$index` is even (otherwise false). |
+ * | `$odd` | {@type boolean} | true if the iterator position `$index` is odd (otherwise false). |
*
* Additionally, you can also provide animations via the ngAnimate attribute to animate the **enter**,
* **leave** and **move** effects.
@@ -354,6 +356,7 @@ var ngRepeatDirective = ['$parse', '$animator', function($parse, $animator) {
childScope.$first = (index === 0);
childScope.$last = (index === (arrayLength - 1));
childScope.$middle = !(childScope.$first || childScope.$last);
+ childScope.$odd = !(childScope.$even = index%2==0);
if (!block.startNode) {
linker(childScope, function(clone) {