How do I make that on the ContactsCreated page the “Back” button return user to root “Contacts” page instead of the NewContact page? So I would like to repalce a page in the navigation stack.
I pretty much described scenario but I;ll try to explain in more details.
On root page I have list of contacts and a “New contact” button. When user clicks it he come to the “New contact” page where she has a “Back” button. By clicking “back” she is canceling contact creation. If she created contact I want to bring here to a “Contact created” page where I want to offer some actions (like inviting the contact to app by email for example) but user can skip this step. To me it seems natural to have a “Back” button but it should not go the previous page with a form to crearte a new contact - she/I expects to get to contacts list.
Sorry - didn’t read your first post. Thanks for detailing.
Seems logical. It appears you could solve this with a modal. iOS 9 phone/contacts app brings up a modal, after which the user is navigated to the new contact.
I haven’t had a reason to try but look at this post and how they add an ng-click to the back button
You could check the current state and if on the state for the new contact use $ionicHistory.goBack(-2) otherwise use $ionicHistory.goBack() to go back to the previous page for all other states.
TypeError: Cannot read property 'instance' of null
at http://localhost:8100/build/js/app.bundle.js:66056:70
at Tab._stage (http://localhost:8100/build/js/app.bundle.js:66112:25)
at Tab._transition (http://localhost:8100/build/js/app.bundle.js:66051:19)
at Tab.popTo (http://localhost:8100/build/js/app.bundle.js:65884:19)
at Tab.popToRoot (http://localhost:8100/build/js/app.bundle.js:65897:26)
at TransferCreated.skip (http://localhost:8100/build/js/app.bundle.js:75556:19)
at AbstractChangeDetector.ChangeDetector_TransferCreated_0.handleEventInternal (eval at <anonymous> (http://localhost:8100/build/js/app.bundle.js:33039:17), <anonymous>:451:30)
at AbstractChangeDetector.handleEvent (http://localhost:8100/build/js/app.bundle.js:32353:25)
at AppView.dispatchEvent (http://localhost:8100/build/js/app.bundle.js:36011:46)
at AppView.dispatchRenderEvent (http://localhost:8100/build/js/app.bundle.js:36005:22)BrowserDomAdapter.logError @ app.bundle.js:48523
app.bundle.js:48523 ERROR CONTEXT:
Hi just came across this, you need to rebuiild the nav path so in the constructor of contacts created reset the root and push the ContactsCreated page.
this.nav.setRoot(ContactsPage);
//you might want to pop some pages → this.nav.pop();
this.nav.push(ContactsPage);
this.nav.push(ContactsCreated);
the back from ContactsCreated will then bring you to contacts