mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
docs(): nav-controller and view-controller
This commit is contained in:
@ -1456,7 +1456,23 @@ let ctrlIds = -1;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* @name NavParams
|
||||||
|
* @description
|
||||||
|
* NavParams are an object that exists on a page and can contain data for that particular view.
|
||||||
|
* Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
|
||||||
|
* option with a simple `get` method.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```ts
|
||||||
|
* export class MyClass{
|
||||||
|
* constructor(params: NavParams){
|
||||||
|
* this.params = params;
|
||||||
|
* // userParams is an object we have in our nav-parameters
|
||||||
|
* this.params.get('userParams');
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
export class NavParams {
|
export class NavParams {
|
||||||
/**
|
/**
|
||||||
@ -1468,8 +1484,20 @@ export class NavParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* Get the value of a nav-parameter for the current view
|
||||||
* @param {string} Which param you want to look up
|
*
|
||||||
|
* ```ts
|
||||||
|
* export class MyClass{
|
||||||
|
* constructor(params: NavParams){
|
||||||
|
* this.params = params;
|
||||||
|
* // userParams is an object we have in our nav-parameters
|
||||||
|
* this.params.get('userParams');
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param {string} parameter Which param you want to look up
|
||||||
*/
|
*/
|
||||||
get(param) {
|
get(param) {
|
||||||
return this.data[param];
|
return this.data[param];
|
||||||
|
@ -189,14 +189,14 @@ export class ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* You can find out of the current view has a Navbar or not. Be sure to wrap this in an `onPageLoaded` method in order to make sure the view has rendered fully.
|
* You can find out of the current view has a Navbar or not. Be sure to wrap this in an `onPageWillEnter` method in order to make sure the view has rendered fully.
|
||||||
*
|
*
|
||||||
* ```typescript
|
* ```typescript
|
||||||
* export class Page1 {
|
* export class Page1 {
|
||||||
* constructor(view: ViewController) {
|
* constructor(view: ViewController) {
|
||||||
* this.view = view
|
* this.view = view
|
||||||
* }
|
* }
|
||||||
* onPageLoaded(){
|
* onPageWillEnter(){
|
||||||
* console.log('Do we have a Navbar?', this.view.hasNavbar());
|
* console.log('Do we have a Navbar?', this.view.hasNavbar());
|
||||||
* }
|
* }
|
||||||
*}
|
*}
|
||||||
@ -257,7 +257,21 @@ export class ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} Set the back button text.
|
* You can change the text of the back button on a view-by-view basis.
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* export class MyClass{
|
||||||
|
* constructor(viewCtrl: ViewController){
|
||||||
|
* this.viewCtrl = viewCtrl
|
||||||
|
* }
|
||||||
|
* onPageWillEnter() {
|
||||||
|
* this.viewCtrl.setBackButtonText('Previous');
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* Make sure you use the view events when calling this method, otherwise the back-button will not have been created
|
||||||
|
*
|
||||||
|
* @param {string} backButtonText Set the back button text.
|
||||||
*/
|
*/
|
||||||
setBackButtonText(val) {
|
setBackButtonText(val) {
|
||||||
let navbar = this.getNavbar();
|
let navbar = this.getNavbar();
|
||||||
@ -267,7 +281,7 @@ export class ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set if the back button for the current view is visible or not. Be sure to wrap this in `onPageLoaded` to make sure the has been compleltly rendered.
|
* Set if the back button for the current view is visible or not. Be sure to wrap this in `onPageWillEnter` to make sure the has been compleltly rendered.
|
||||||
* @param {boolean} Set if this Page's back button should show or not.
|
* @param {boolean} Set if this Page's back button should show or not.
|
||||||
*/
|
*/
|
||||||
showBackButton(shouldShow) {
|
showBackButton(shouldShow) {
|
||||||
|
Reference in New Issue
Block a user