In my ionic project i used expandable card view in two pages.The problem is when i go to one page and click the card it work correctly. then i go to second page and click the card ,it didn’t work(but the function is calling correctly) when i use setRoot() method to go to next page it work clearly.but when i use push() method it didn’t work.
html:
<ion-card *ngFor= "let item of objectData;let k=index;" style="border: 2px solid #9D9D9D;border-radius: 10px;">
<ion-card-content (click)="showmore(k,item.carrierFsCode,item.arrivalAirportFsCode,item.departureAirportFsCode,item.flightId);" id="{{k}}" style="display: block">
</ion-card-content>
.................
..............
............
<ion-card-content class="panel" id="{{k}}second" style="display: none" (click)="showless(k);">
..............
.................
.........
</ion-card-content>
</ion-card>
ts code:
showmore(k,flightcode,arrivalairportcode,departureairportcode,flightid)
{
document.getElementById(k).style.display = 'none';
document.getElementById(k+"second").style.display = 'block';
this.getAirlileName(flightcode);
this.getArrivalAirportCiy(arrivalairportcode);
this.getDepartureAirportCiy(departureairportcode);
this.getDataFromStorage(flightid);
}
showless(k)
{
document.getElementById(k+"second").style.display = 'none';
document.getElementById(k).style.display = 'block';
}
the problem become when i use this
this.navCtrl.push(DeparturePage)
.
but when i use this.navCtrl.setRoot(DeparturePage)
like this it work correctly