docs(): nav-controller and view-controller

This commit is contained in:
mhartington
2015-12-07 10:43:11 -05:00
parent 0dc41633a1
commit be4601319b
2 changed files with 49 additions and 7 deletions

View File

@ -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 {
/**
@ -1468,8 +1484,20 @@ export class NavParams {
}
/**
* TODO
* @param {string} Which param you want to look up
* Get the value of a nav-parameter for the current view
*
* ```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) {
return this.data[param];

View File

@ -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
* export class Page1 {
* constructor(view: ViewController) {
* this.view = view
* }
* onPageLoaded(){
* onPageWillEnter(){
* 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) {
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.
*/
showBackButton(shouldShow) {