docs(): viewController and navController docs

This commit is contained in:
mhartington
2015-12-01 16:43:15 -05:00
parent 42b60bc172
commit 8c982fbc3d
2 changed files with 23 additions and 32 deletions

View File

@ -221,7 +221,6 @@ export class NavController extends Ion {
* },{ * },{
* // here we can configure things like the animations direction or * // here we can configure things like the animations direction or
* // or if the view should animate at all. * // or if the view should animate at all.
* animate: true,
* direction: back * direction: back
* }); * });
* } * }
@ -298,12 +297,8 @@ export class NavController extends Ion {
* constructor(nav:NavController){ * constructor(nav:NavController){
* this.nav = nav; * this.nav = nav;
* } * }
*
* goBack(){ * goBack(){
* this.nav.pop({ * this.nav.pop();
* animate: true,
* direction: back
* });
* } * }
* } * }
* ``` * ```
@ -510,8 +505,8 @@ export class NavController extends Ion {
* constructor(nav: NavController) { * constructor(nav: NavController) {
* this.nav = nav; * this.nav = nav;
* } * }
* setView() { * setPages() {
* this.nav.setViews([List,Detail, Info]); * this.nav.setPages([List,Detail, Info]);
* } * }
* } * }
*``` *```
@ -531,8 +526,8 @@ export class NavController extends Ion {
* constructor(nav: NavController) { * constructor(nav: NavController) {
* this.nav = nav; * this.nav = nav;
* } * }
* setView() { * setPages() {
* this.nav.setViews([List,Detail, Info],{ * this.nav.setPages([List,Detail, Info],{
* animate: true * animate: true
* }); * });
* } * }
@ -552,8 +547,8 @@ export class NavController extends Ion {
* constructor(nav: NavController) { * constructor(nav: NavController) {
* this.nav = nav; * this.nav = nav;
* } * }
* setView() { * setPages() {
* this.nav.setViews([{ * this.nav.setPages([{
* componentType: List, * componentType: List,
* params: {id: 43} * params: {id: 43}
* }, { * }, {
@ -562,16 +557,14 @@ export class NavController extends Ion {
* },{ * },{
* componentType: Info, * componentType: Info,
* params: {id: 5} * params: {id: 5}
* } ],{ * }]);
* animate: true
* });
* } * }
* } * }
*``` *```
* *
* @param {Array} component an arry of components to load in the stack * @param {Array} component an arry of components to load in the stack
* @param {Object} [opts={}] Any options you want to use pass * @param {Object} [opts={}] Any options you want to use pass
* @returns {Promise} Returns a promise when the views are set * @returns {Promise} Returns a promise when the pages are set
*/ */
setPages(components, opts = {}) { setPages(components, opts = {}) {
if (!components || !components.length) { if (!components || !components.length) {
@ -1091,9 +1084,9 @@ export class NavController extends Ion {
} }
/** /**
* Returns `true` if there's a valid previous view that we can pop back to. * Returns `true` if there's a valid previous page that we can pop back to.
* Otherwise returns false. * Otherwise returns false.
* @returns {boolean} Whether there is a view to go back to * @returns {boolean} Whether there is a page to go back to
*/ */
canGoBack() { canGoBack() {
let activeView = this.getActive(); let activeView = this.getActive();
@ -1121,7 +1114,7 @@ export class NavController extends Ion {
}); });
// allow clicks again, but still set an enable time // allow clicks again, but still set an enable time
// meaning nothing with this view controller can happen for XXms // meaning nothing with this page controller can happen for XXms
this.app.setEnabled(true); this.app.setEnabled(true);
this.setTransitioning(false); this.setTransitioning(false);
@ -1136,7 +1129,7 @@ export class NavController extends Ion {
* @private * @private
*/ */
_cleanup(activeView) { _cleanup(activeView) {
// the active view, and the previous view, should be rendered in dom and ready to go // the active page, and the previous page, should be rendered in dom and ready to go
// all others, like a cached page 2 back, should be display: none and not rendered // all others, like a cached page 2 back, should be display: none and not rendered
let destroys = []; let destroys = [];
activeView = activeView || this.getActive(); activeView = activeView || this.getActive();
@ -1154,7 +1147,7 @@ export class NavController extends Ion {
} }
}); });
// all views being destroyed should be removed from the list of views // all pages being destroyed should be removed from the list of pages
// and completely removed from the dom // and completely removed from the dom
destroys.forEach(view => { destroys.forEach(view => {
this._remove(view); this._remove(view);
@ -1248,7 +1241,7 @@ export class NavController extends Ion {
} }
/** /**
* @param {Index} The index of the view you want to get * @param {Index} The index of the page you want to get
* @returns {Component} Returns the component that matches the index given * @returns {Component} Returns the component that matches the index given
*/ */
getByIndex(index) { getByIndex(index) {
@ -1260,7 +1253,7 @@ export class NavController extends Ion {
/** /**
* @private * @private
* @param {Handle} The handle of the view you want to get * @param {Handle} The handle of the page you want to get
* @returns {Component} Returns the component that matches the handle given * @returns {Component} Returns the component that matches the handle given
*/ */
getByHandle(handle) { getByHandle(handle) {
@ -1305,9 +1298,8 @@ export class NavController extends Ion {
} }
/** /**
* First view in this nav controller's stack. This would * First page in this nav controller's stack. This would not return a page which is about to be destroyed.
* not return an view which is about to be destroyed. * @returns {Component} Returns the first component page in the current stack
* @returns {Component} Returns the first component view in the current stack
*/ */
first() { first() {
for (let i = 0, l = this._views.length; i < l; i++) { for (let i = 0, l = this._views.length; i < l; i++) {
@ -1319,9 +1311,8 @@ export class NavController extends Ion {
} }
/** /**
* Last view in this nav controller's stack. This would * Last page in this nav controller's stack. This would not return a page which is about to be destroyed.
* not return an view which is about to be destroyed. * @returns {Component} Returns the last component page in the current stack
* @returns {Component} Returns the last component view in the current stack
*/ */
last() { last() {
for (let i = this._views.length - 1; i >= 0; i--) { for (let i = this._views.length - 1; i >= 0; i--) {

View File

@ -170,14 +170,14 @@ export class ViewController {
} }
/** /**
* You can find out of the current view has a Navbar or not. Be sure to wrap this in an `onInit` 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 `onPageLoaded` 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
* } * }
* onInit(){ * onPageLoaded(){
* console.log('Do we have a Navbar?', this.view.hasNavbar()); * console.log('Do we have a Navbar?', this.view.hasNavbar());
* } * }
*} *}
@ -248,7 +248,7 @@ export class ViewController {
} }
/** /**
* Set if the back button for the current view is visible or not. Be sure to wrap this in `onInit` 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 `onPageLoaded` 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) {