From fef0cc056932ff059f71357a146b7e61712fb2e7 Mon Sep 17 00:00:00 2001 From: demike Date: Thu, 10 Oct 2013 08:25:50 +0200 Subject: [PATCH 1/2] use &1 instead of %2 for even odd checking use "index&1==0" instead of "index%2==0" for even odd checking --- src/ng/directive/ngRepeat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng/directive/ngRepeat.js b/src/ng/directive/ngRepeat.js index bce76411beea..f9340e9a728f 100644 --- a/src/ng/directive/ngRepeat.js +++ b/src/ng/directive/ngRepeat.js @@ -374,7 +374,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { childScope.$first = (index === 0); childScope.$last = (index === (arrayLength - 1)); childScope.$middle = !(childScope.$first || childScope.$last); - childScope.$odd = !(childScope.$even = index%2==0); + childScope.$odd = !(childScope.$even = index&1==0); if (!block.startNode) { linker(childScope, function(clone) { From 5bd1b6b3ca312e904d98b9cfcc9f734678a3e20d Mon Sep 17 00:00:00 2001 From: demike Date: Thu, 10 Oct 2013 09:08:19 +0200 Subject: [PATCH 2/2] Use parenthesis (index&1)==0 --- src/ng/directive/ngRepeat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng/directive/ngRepeat.js b/src/ng/directive/ngRepeat.js index f9340e9a728f..bae6338e1724 100644 --- a/src/ng/directive/ngRepeat.js +++ b/src/ng/directive/ngRepeat.js @@ -374,7 +374,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { childScope.$first = (index === 0); childScope.$last = (index === (arrayLength - 1)); childScope.$middle = !(childScope.$first || childScope.$last); - childScope.$odd = !(childScope.$even = index&1==0); + childScope.$odd = !(childScope.$even = (index&1)==0); if (!block.startNode) { linker(childScope, function(clone) {