Ionic2 ngOnInit、ionViewWillEnter和导航按钮

Ionic2 ngOnInit、ionViewWillEnter和导航按钮,ionic2,Ionic2,在这种情况下,通过[nav push]从离子项目导航到细节页面时,细节页面上的离子视图将不会调用ENTER,而ngOnInit会调用 //ion-item on list page... <button ion-item detail-push *ngFor="let recipe of recipes" [navPush]="recipeEditPage" [navParams]="{recipe:recipe}">

在这种情况下,通过
[nav push]
离子项目导航到细节页面时,细节页面上的
离子视图将不会调用ENTER
,而
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();
  }
//列表页上的离子项。。。
{{recipe.title}
//详细信息页面,ionWillEnter不开火,white Ngonit开火。
恩戈尼尼特(){
if(this.navParams.data.recipe){
这是._mode=RecipeEditPage.Modes.EDIT;
this._recipe=this.navParams.data.recipe;
}
其他的
this._recipe=this.recipeSrv.getNewRecipe();
}

谢谢!F.

ionViewWillEnter的代码如何?正如您在Ngonint中看到的一样,我只是用ionViewWillEnter替换了该方法,并且我没有在page类中实现接口。