The NavController.remove function doesnt work as docs states. It cant remove pages in some cases when it should be able to.
NavController.remove works as docs states and remove pages from the stack the correct way.
Steps to reproduce:
For testing you will have to expose the NavController in the last page with console.log. (In the constructor add console.log(this.nav));
We will use this code snippet to list the stack, because no built in options exist for it now at the moment.
[
(temp1.getByIndex(0))?temp1.getByIndex(0).instance:null,
(temp1.getByIndex(1))?temp1.getByIndex(1).instance:null,
(temp1.getByIndex(2))?temp1.getByIndex(2).instance:null,
(temp1.getByIndex(3))?temp1.getByIndex(3).instance:null,
(temp1.getByIndex(4))?temp1.getByIndex(4).instance:null,
(temp1.getByIndex(5))?temp1.getByIndex(5).instance:null,
]
temp1.remove(temp1.length() - 2, 2)Note: This seems not to work only if I try to remove the last 2 page. With the last 1 or 3 it works well. So temp1.remove(temp1.length() - 1, 1) and temp1.remove(temp1.length() - 2, 2) produces the same result.
Which Ionic Version? 2.x
Run ionic info from terminal/cmd prompt: (paste output below)
Cordova CLI: 6.3.1
Gulp version: CLI version 1.2.2
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
ios-deploy version: 1.9.0
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v6.3.1
Xcode version: Xcode 8.0 Build version 8A218a
same problem for me here.
I have this code that worked on Beta11 but in RC0 it's not working anymore.
this.nav.push(MyNextPage, params).then(() => {
this.nav.remove(this.nav.getActive().index - 1, 1);
});
I tried to remove the nav.remove from inside the promise but it didn't work either
Do we have any official hint how to handle this in the meantime?
Our navigation is heavily based on this function. We have pretty hard time figuring out how to solve this efficiently without making big modifications to our current navigation.
@rodriguesgm can you explain the effect you are going for there? You want to push a new page and then once that's pushed, remove the page you just came from?
I just tested this and the case of removing 1 works for me, digging deeper.
Weird, this does appear to only break for me once the stack is >= 5. Anyone have a test project to share? I'm not seeing any issues when stack < 5.
I found the issue, fixing
Thanks for the info everyone, this is fixed and will be in the next release.
Hi @mlynch, thanks for the fix! Been trying to debug this for a couple hours, glad to see this issue has been resolved.
Would love for it to be released very soon however :) :) :)
There's a regression on this ?
I have still this issue
There's a regression on this ?
I have still this issue
this.navCtrl.remove not work
There's a regression on this ?
I have still this issue
this.navCtrl.remove not work
I have the same problem.
this.navCtrl.remove not work
If you provide some step you did to debug the problem, and cc a team member, maybe it will be checked sooner. At least test in which version of ionic the regression happened.
(We dont need this right now, so I have no time to check this now.)
Problem solved #12238
I am still facing this issue. Ionic-angular 3.5.3.
isTransitioning is still true after remove
me too.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Most helpful comment
Thanks for the info everyone, this is fixed and will be in the next release.