我有这种情况,[nav-push]
从ion-item
导航到详细信息页面,在详细信息页面ionViewWillEnter
上不会被调用,而ngOnInit
会这样做。
//ion-item on list page...
<button ion-item detail-push
*ngFor="let recipe of recipes"
[navPush]="recipeEditPage"
[navParams]="{recipe:recipe}">
<h2>{{recipe.title}}</h2>
</button>
//details page, ionWillEnter doesn't fire, white ngOnInit does.
ngOnInit(){
if(this.navParams.data.recipe){
this._mode = RecipeEditPage.Modes.EDIT;
this._recipe=this.navParams.data.recipe;
}
else
this._recipe = this.recipeSrv.getNewRecipe();
}
谢谢! F。