@@ -103,12 +103,18 @@ export class NavControllerBase extends Ion implements NavController {
103
103
}
104
104
105
105
popTo ( indexOrViewCtrl : any , opts ?: NavOptions , done ?: Function ) : Promise < any > {
106
- const startIndex = isViewController ( indexOrViewCtrl ) ? this . indexOf ( indexOrViewCtrl ) : isNumber ( indexOrViewCtrl ) ? indexOrViewCtrl : - 1 ;
107
- return this . _queueTrns ( {
108
- removeStart : startIndex + 1 ,
106
+ let config : TransitionInstruction = {
107
+ removeStart : - 1 ,
109
108
removeCount : - 1 ,
110
- opts : opts ,
111
- } , done ) ;
109
+ opts : opts
110
+ } ;
111
+ if ( isViewController ( indexOrViewCtrl ) ) {
112
+ config . removeView = indexOrViewCtrl ;
113
+ config . removeStart = 1 ;
114
+ } else if ( isNumber ( indexOrViewCtrl ) ) {
115
+ config . removeStart = indexOrViewCtrl + 1 ;
116
+ }
117
+ return this . _queueTrns ( config , done ) ;
112
118
}
113
119
114
120
popToRoot ( opts ?: NavOptions , done ?: Function ) : Promise < any > {
@@ -138,6 +144,8 @@ export class NavControllerBase extends Ion implements NavController {
138
144
removeView ( viewController : ViewController , opts ?: NavOptions , done ?: Function ) : Promise < any > {
139
145
return this . _queueTrns ( {
140
146
removeView : viewController ,
147
+ removeStart : 0 ,
148
+ removeCount : 1 ,
141
149
opts : opts ,
142
150
} , done ) ;
143
151
}
@@ -295,16 +303,15 @@ export class NavControllerBase extends Ion implements NavController {
295
303
const viewsLength = this . _views . length ;
296
304
297
305
if ( isPresent ( ti . removeView ) ) {
298
- assert ( ! isPresent ( ti . removeStart ) , 'removeView and removeIndex can not be enabled at the same time ' ) ;
299
- let index = this . _views . indexOf ( ti . removeView ) ;
306
+ assert ( isPresent ( ti . removeStart ) , 'removeView needs removeStart ' ) ;
307
+ assert ( isPresent ( ti . removeCount ) , ' removeView needs removeCount' ) ;
300
308
309
+ let index = this . _views . indexOf ( ti . removeView ) ;
301
310
if ( index >= 0 ) {
302
- ti . removeStart = index ;
303
- ti . removeCount = 1 ;
304
- ti . leavingRequiresTransition = ( ( ti . removeStart + ti . removeCount ) === viewsLength ) ;
311
+ ti . removeStart += index ;
305
312
}
306
-
307
- } else if ( isPresent ( ti . removeStart ) ) {
313
+ }
314
+ if ( isPresent ( ti . removeStart ) ) {
308
315
if ( ti . removeStart < 0 ) {
309
316
ti . removeStart = ( viewsLength - 1 ) ;
310
317
}
0 commit comments