I am making an App in Ionic.
At one point in the App I need to press a button and close the current page I am on.
I do it in the following way:
- This is how I declare the button in the HTML view:
<button ion-button full (click)="guardarNuevoPerfil()">Guardar Perfil</button>
and this is the saveNewProfile() method of the Typescript part:
this.storage.get('listadoPerfiles').then((perfiles) => {
//Aquí guardo el perfil, justo despues necesito cerrar la página actual
window.close(); //No funciona
self.close(); //No funciona
});
As you can see in the code, I've tried window.close() and seslf.close() but it doesn't do anything, it doesn't close the tab.
This is the behavior I want to have:
I have searched in google and nothing has come up, practically everything that comes out in for Javascript.
I answer you here. Your page constructor should have something similar to this:
So if you want to leave the current page and go to the previous one you have to do this:
You can review the NavController methods here:
Description of NavController functions