Hi
I am having issue with cache & navigation, please look at screens.its simple tab app.
steps to generate issue.
initially its load home page.
then click on page1 link(used [navPush]=“page1” to navigate)
then click to contact tab
then click to home tab → its shows page1(which is cached) and another point here any of the lifecycle events are not excuting
then if you click home tab again it will work.
How to avoid this cache issue?
ionic info
global packages:
@ionic/cli-utils : 1.5.0
Cordova CLI : 7.0.1
Ionic CLI : 3.5.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.4.2
System:
Node : v6.11.0
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b
ios-deploy : 1.9.1
ios-sim : 6.0.0
npm : 3.10.10
I have made below changes in cutePuppyPics template
home.html
<ion-header>
<ion-navbar>
<ion-title>Home</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<h2>Welcome to Ionic!</h2>
<p>
This starter project comes with simple tabs-based layout for apps
that are going to primarily use a Tabbed UI.
</p>
<button ion-button full [navPush]="page1">page1</button>
<button ion-button full [navPush]="page2">page2</button>
<button ion-button full [navPush]="page3">page3</button>
<p>
Take a look at the <code>src/pages/</code> directory to add or change tabs,
update any existing page or create new pages.
</p>
</ion-content>
home.ts
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Page1Page } from '../page1/page1';
import { Page2Page } from '../page2/page2';
import { Page3Page } from '../page3/page3';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
page1 = Page1Page;
page2 = Page2Page;
page3 = Page3Page;
constructor(public navCtrl: NavController) {
console.log("construct 0 home");
}
ngOnInit() { console.log("ngOnInit 0 home"); }
ionViewWillEnter() { console.log("ionViewWillEnter 1 home"); }
ionViewDidEnter() { console.log("ionViewDidEnter 2 home"); }
ionViewWillLeave() { console.log("ionViewWillLeave l1 home"); }
ionViewDidLeave() { console.log("ionViewDidLeave l2 home"); }
ionViewWillUnload() { console.log("ionViewWillUnload l3 home"); }
ionViewCanEnter() { console.log("ionViewCanEnter 3 home"); }
ionViewCanLeave() { console.log("ionViewCanLeave l4 home"); }
ionViewDidLoad() {
console.log("ionViewDidLoad 4 home");
}
}
event flow
1)Home ==>2)Page1==>3)Contact(Tab)==>4)Home(Tab)==>5)Home(Tab)
on 4th step none of the life cycle event codes executing.
on 5th step its shows correct view which should appear on 4th step
some of the unsolved similar issue