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
willEnter
Observable to be subscribed to when the current component will become active
Observable
Returns an observable
didEnter
Observable to be subscribed to when the current component has 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
didLeave
Observable to be subscribed to when the current component is no long active
Observable
Returns an observable
willUnload
Observable to be subscribed to when the current component has been destroyed
Observable
Returns an observable
component
onDidDismiss()
Called when the current viewController has be successfully dismissed
onWillDismiss()
Called when the current viewController will be dismissed
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.
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.
pageRef()
ElementRef
Returns the Page's ElementRef.
getContent()
component
Returns the Page's Content component reference.
contentRef()
ElementRef
Returns the Content's ElementRef.
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.
setBackButtonText(backButtonText)
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 |
---|---|---|
backButtonText |
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. |