ViewController
Access various features and information about the current view.
Usage
import { Component } from '@angular/core';
import { ViewController } from 'ionic-angular';
@Component({...})
export class MyPage{
constructor(public viewCtrl: ViewController) {}
}
Instance Members
component
contentRef()
ElementRef Returns the Content's ElementRef.
didEnter
Observable to be subscribed to when the current component has become active
Observable Returns an observable
didLeave
Observable to be subscribed to when the current component is no long active
Observable Returns an observable
dismiss(data, role , navOptions)
Dismiss the current viewController
| Param | Type | Details |
|---|---|---|
| data |
any
|
Data that you want to return when the viewController is dismissed.Optional |
| role |
any
|
Optional |
| navOptions |
NavOptions
|
Options for the dismiss navigation. |
any data Returns the data passed in, if any.
enableBack()
Check to see if you can go back in the navigation stack.
boolean Returns if it's possible to go back from this Page.
getContent()
component Returns the Page's Content component reference.
hasNavbar()
Find out if the current component has a NavBar or not. Be sure
to wrap this in an ionViewWillEnter method in order to make sure
the view has rendered fully.
boolean Returns a boolean if this Page has a navbar or not.
index
Get the index of the current component in the current navigation stack.
number Returns the index of this page within its NavController.
isFirst()
boolean Returns if this Page is the first in the stack of pages within its NavController.
isLast()
boolean Returns if this Page is the last in the stack of pages within its NavController.
onDidDismiss()
Called when the current viewController has be successfully dismissed
onWillDismiss()
Called when the current viewController will be dismissed
pageRef()
ElementRef Returns the Page's ElementRef.
setBackButtonText(val)
Change the title of the back-button. Be sure to call this
after ionViewWillEnter to make sure the DOM has been rendered.
| Param | Type | Details |
|---|---|---|
| val |
string
|
Set the back button text. |
showBackButton(Set)
Set if the back button for the current view is visible or not. Be sure to call this
after ionViewWillEnter to make sure the DOM has been rendered.
| Param | Type | Details |
|---|---|---|
| Set |
boolean
|
if this Page's back button should show or not. |
willEnter
Observable to be subscribed to when the current component will become active
Observable Returns an observable
willLeave
Observable to be subscribed to when the current component will no longer be active
Observable Returns an observable
willUnload
Observable to be subscribed to when the current component has been destroyed
Observable Returns an observable