당신은 이온이 NavController로보기 라이프 사이클 후크 세트를 패키지 here
이온 2에 대한 보기 라이프 사이클 후크 자세한 정보를 찾을 수 있습니다. 그들은 이벤트 핸들러의 네 가지 패턴을 따르
귀하의 경우
1. onPageLoaded works the same way as ngOnInit
2. onPageWillEnter and onPageDidEnter are hooks that are available before and after the page in question becomes active
3. onPageWillLeave and onPageDidLeave are hooks that are available before and after the page leaves the viewport
4. onPageWillUnload and onPageDidUnload are hooks that are available before and after the page is removed from the DOM
, 나는 당신이 찾고있는 사람이 생각 onPageWillEnter
============
편집 : 이온에
2.0.0-beta.8 (2016년 6월 6일)는 이온 라이프 사이클 이벤트의 이름이 변경되었습니다 :
,363,210
onPageLoaded renamed to ionViewLoaded
onPageWillEnter renamed to ionViewWillEnter
onPageDidEnter renamed to ionViewDidEnter
onPageWillLeave renamed to ionViewWillLeave
onPageDidLeave renamed to ionViewDidLeave
onPageWillUnload renamed to ionViewWillUnload
onPageDidUnload renamed to ionViewDidUnload
그래서 당신이 사용할 필요가하려는 일입니다 ionViewWillEnter
당신이 물리게으로, [이]를 읽을하시기 할 수있는 (https://solidfoundationwebdev.com/blog/posts/require-authentication -for-certain-routes-with-ui-router-in-angularjs)와 ui-router에 대해 더 많이 연구합니다. – macrog
그래서 저는 구형 각도 1.x 앱에서 실제로 이것을 사용하고 있습니다. angular2/ionic2에도 적용 할 수 있습니까? ? –
ups, 미안하지만, 나쁘지 않아, 당신이 물어 본 버전 2라고 생각하지 못했습니다 : / – macrog