* | `ionViewDidLoad` | void | Runs when the page has loaded. This event only happens once per page being created. If a page leaves but is cached, then this event will not fire again on a subsequent viewing. The `ionViewDidLoad` event is good place to put your setup code for the page. |
253
* | `ionViewWillEnter` | void | Runs when the page is about to enter and become the active page. |
254
* | `ionViewDidEnter` | void | Runs when the page has fully entered and is now the active page. This event will fire, whether it was the first load or a cached page. |
255
* | `ionViewWillLeave` | void | Runs when the page is about to leave and no longer be the active page. |
256
* | `ionViewDidLeave` | void | Runs when the page has finished leaving and is no longer the active page. |
257
* | `ionViewWillUnload` | void | Runs when the page is about to be destroyed and have its elements removed. |
258
* | `ionViewCanEnter` | boolean/Promise<void> | Runs before the view can enter. This can be used as a sort of "guard" in authenticated views where you need to check permissions before the view can enter |
259
* | `ionViewCanLeave` | boolean/Promise<void> | Runs before the view can leave. This can be used as a sort of "guard" in authenticated views where you need to check permissions before the view can leave |
260
*
261
* Those events are only fired on IonicPage, for classic Angular Component, use [Angular Lifecycle Hooks](https://angular.io/guide/lifecycle-hooks).
262
*
263
* ## Nav Guards
264
*
265
* In some cases, a developer should be able to control views leaving and entering. To allow for this, NavController has the `ionViewCanEnter` and `ionViewCanLeave` methods.
266
* Similar to Angular route guards, but are more integrated with NavController. For example, if you wanted to prevent a user from leaving a view:
267
*
268
* ```ts
269
* export class MyClass{
270
* constructor(
271
* public navCtrl: NavController
272
* ){}
273
*
274
* pushPage(){
275
* this.navCtrl.push(DetailPage);
276
* }
277
*
278
* ionViewCanLeave(): boolean{
279
* // here we can either return true or false
280
* // depending on if we want to leave this view
281
* if(isValid(randomValue)){
282
* return true;
283
* } else {
284
* return false;
285
* }
286
* }
287
* }
288
* ```
289
*
290
* We need to make sure that our `navCtrl.push` has a catch in order to catch the and handle the error.
291
* If you need to prevent a view from entering, you can do the same thing
292
*
293
* ```ts
294
* export class MyClass{
295
* constructor(
296
* public navCtrl: NavController
297
* ){}
298
*
299
* pushPage(){
300
* this.navCtrl.push(DetailPage);
301
* }
302
*
303
* }
304
*
305
* export class DetailPage(){
306
* constructor(
307
* public navCtrl: NavController
308
* ){}
309
* ionViewCanEnter(): boolean{
310
* // here we can either return true or false
311
* // depending on if we want to enter this view
312
* if(isValid(randomValue)){
313
* return true;
314
* } else {
315
* return false;
316
* }
317
* }
318
* }
319
* ```
320
*
321
* Similar to `ionViewCanLeave` we still need a catch on the original `navCtrl.push` in order to handle it properly.
322
* When handling the back button in the `ion-navbar`, the catch is already taken care of for you by the framework.
323
*
324
* ## NavOptions
325
*
326
* Some methods on `NavController` allow for customizing the current transition.
327
* To do this, we can pass an object with the modified properites.