File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,10 @@ var ngSwitchDirective = ['$animate', function($animate) {
144
144
previousLeaveAnimations = [ ] ,
145
145
selectedScopes = [ ] ;
146
146
147
+ var spliceFactory = function ( array , index ) {
148
+ return function ( ) { array . splice ( index , 1 ) ; } ;
149
+ } ;
150
+
147
151
scope . $watch ( watchExpr , function ngSwitchWatchAction ( value ) {
148
152
var i , ii ;
149
153
for ( i = 0 , ii = previousLeaveAnimations . length ; i < ii ; ++ i ) {
@@ -155,11 +159,7 @@ var ngSwitchDirective = ['$animate', function($animate) {
155
159
var selected = getBlockNodes ( selectedElements [ i ] . clone ) ;
156
160
selectedScopes [ i ] . $destroy ( ) ;
157
161
var promise = previousLeaveAnimations [ i ] = $animate . leave ( selected ) ;
158
- promise . then ( ( function ( i ) {
159
- return function ( ) {
160
- previousLeaveAnimations . splice ( i , 1 ) ;
161
- } ;
162
- } ( i ) ) ) ;
162
+ promise . then ( spliceFactory ( previousLeaveAnimations , i ) ) ;
163
163
}
164
164
165
165
selectedElements . length = 0 ;
You can’t perform that action at this time.
0 commit comments