Hello everyone, i’m making an App for IOS, with a menu that has several buttons on it. And, i encountered an issue, the first time i click on a button, that invoques an NavCtrl.push() to show the content of that button it works just fine, but when i go back to the principal menu, and try to click on another button, it doesn’t work the first time, i have to click on it a few times to make it work.
I think that the issue is that when i go back to the menu, the app is not ready to recieve clicks on the buttons. Can that happen?
Thank you so much.
This is the code:
HOME.HTML
<ion-content overflow-scroll="false">
<img class="header_image" src="{{headers}}">
<img src="assets/imgs/logo_320.png" [ngClass]="{ 'hide': this.mostrar==0 }" class="icono_vivilacosta animation-target">
<ion-grid>
<ion-row justify-content-center align-items-center>
<ion-col *ngFor="let inicio of principal" class="Cuadrados {{inicio.clase}}" (click)="VerPagina(inicio.pagina)">
<div class="ConteinerIcono">
<img src="{{inicio.icono}}" class="icono ">
<p class="Categoria"> {{inicio.titulo}} </p>
</div>
</ion-col>
</ion-row>
</ion-grid>
HOME.TS:
export class HomePage {
principal;
url;
headers;
mostrar;
constructor(public navCtrl: NavController, public http: HttpClient,public loadingCtrl: LoadingController) {
this.url = '*********';
let loading = this.loadingCtrl.create({
content: 'Cargando...'
});
loading.present();
this.http.get(this.url).subscribe((data) => {
if (Object.keys(data).length!=0){
this.headers = data[0].imageUrl;
this.mostrar = data[0].logoVisibility;
} else {
this.headers = 'assets/imgs/header.png';
this.mostrar = 1;
}
loading.dismiss();
});
this.principal = [
{
titulo: 'EVENTOS',
clase: 'EVENTOS',
pagina: 'EventosPage',
icono: 'assets/imgs/eventos.png'
},
{
titulo: 'CINE Y TEATRO',
clase: 'CINESYTEATROS',
pagina: 'CinesPage',
icono: 'assets/imgs/cineteatro.png'
},
{
titulo: 'NOTICIAS',
clase: 'NOTICIAS',
pagina: 'NoticiasPage',
icono: 'assets/imgs/noticias.png'
},
{
titulo: 'PARQUES',
clase: 'PARQUES',
pagina: 'ParquesPage',
icono: 'assets/imgs/parques.png'
},
{
titulo: 'CAJEROS',
clase: 'CAJEROS',
pagina: 'CajerosPage',
icono: 'assets/imgs/cajeros.png'
},
{
titulo: 'TELEFONOS',
clase: 'TELEFONOS',
pagina: 'TelefonosPage',
icono: 'assets/imgs/telefonos.png'
}
];
}
VerPagina(Variable){
switch(Variable) {
case 'EventosPage': {
this.navCtrl.push(EventosPage);
break;
}
case 'CinesPage': {
this.navCtrl.push(CinesPage);
break;
}
case 'NoticiasPage': {
this.navCtrl.push(NoticiasPage);
break;
}
case 'ParquesPage': {
this.navCtrl.push(ParquesPage);
break;
}
case 'TelefonosPage': {
this.navCtrl.push(TelefonosPage);
break;
}
case 'CajerosPage': {
this.navCtrl.push(CajerosPage);
break;
}
}
}
}