@@ -225,6 +225,14 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
225225 // jshint bitwise: true
226226 } ;
227227
228+ var getBlockStart = function ( block ) {
229+ return block . clone [ 0 ] ;
230+ } ;
231+
232+ var getBlockEnd = function ( block ) {
233+ return block . clone [ block . clone . length - 1 ] ;
234+ } ;
235+
228236
229237 return {
230238 restrict : 'A' ,
@@ -292,7 +300,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
292300 var lastBlockMap = { } ;
293301
294302 //watch props
295- $scope . $watchCollection ( rhs , function ngRepeatAction ( collection ) {
303+ $scope . $watchCollection ( rhs , function ngRepeatAction ( collection ) {
296304 var index , length ,
297305 previousNode = $element [ 0 ] , // current position of the node
298306 nextNode ,
@@ -343,15 +351,15 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
343351 nextBlockOrder [ index ] = block ;
344352 } else if ( nextBlockMap . hasOwnProperty ( trackById ) ) {
345353 // restore lastBlockMap
346- forEach ( nextBlockOrder , function ( block ) {
354+ forEach ( nextBlockOrder , function ( block ) {
347355 if ( block && block . scope ) lastBlockMap [ block . id ] = block ;
348356 } ) ;
349357 // This is a duplicate and we need to throw an error
350358 throw ngRepeatMinErr ( 'dupes' , "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}" ,
351- expression , trackById ) ;
359+ expression , trackById ) ;
352360 } else {
353361 // new never before seen block
354- nextBlockOrder [ index ] = { id : trackById , scope : undefined , clone : undefined } ;
362+ nextBlockOrder [ index ] = { id : trackById , scope : undefined , clone : undefined } ;
355363 nextBlockMap [ trackById ] = false ;
356364 }
357365 }
@@ -363,7 +371,9 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
363371 block = lastBlockMap [ blockKey ] ;
364372 elementsToRemove = getBlockNodes ( block . clone ) ;
365373 $animate . leave ( elementsToRemove ) ;
366- forEach ( elementsToRemove , function ( element ) { element [ NG_REMOVED ] = true ; } ) ;
374+ forEach ( elementsToRemove , function ( element ) {
375+ element [ NG_REMOVED ] = true ;
376+ } ) ;
367377 block . scope . $destroy ( ) ;
368378 }
369379 }
@@ -381,7 +391,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
381391 nextNode = previousNode ;
382392 do {
383393 nextNode = nextNode . nextSibling ;
384- } while ( nextNode && nextNode [ NG_REMOVED ] ) ;
394+ } while ( nextNode && nextNode [ NG_REMOVED ] ) ;
385395
386396 if ( getBlockStart ( block ) != nextNode ) {
387397 // existing item which got moved
@@ -411,13 +421,5 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
411421 } ;
412422 }
413423 } ;
414-
415- function getBlockStart ( block ) {
416- return block . clone [ 0 ] ;
417- }
418-
419- function getBlockEnd ( block ) {
420- return block . clone [ block . clone . length - 1 ] ;
421- }
422424} ] ;
423425
0 commit comments