docs(viewController, picker, popover, toast, gestures, utils): update docs

This commit is contained in:
mhartington
2016-06-30 15:50:26 -04:00
parent fbe6f82c89
commit cd6ad23ef3
7 changed files with 68 additions and 61 deletions

View File

@ -42,11 +42,40 @@ export class ViewController {
private _cd: ChangeDetectorRef;
protected _nav: NavController;
/**
* Observable to be subscribed to when the current component will become active
* @returns {Observable} Returns an observable
*/
willEnter: EventEmitter<any>;
/**
* Observable to be subscribed to when the current component has become active
* @returns {Observable} Returns an observable
*/
didEnter: EventEmitter<any>;
/**
* Observable to be subscribed to when the current component will no longer be active
* @returns {Observable} Returns an observable
*/
willLeave: EventEmitter<any>;
/**
* Observable to be subscribed to when the current component is no long active
* @returns {Observable} Returns an observable
*/
didLeave: EventEmitter<any>;
/**
* Observable to be subscribed to when the current component will be destroyed
* @returns {Observable} Returns an observable
*/
willUnload: EventEmitter<any>;
/**
* Observable to be subscribed to when the current component has been destroyed
* @returns {Observable} Returns an observable
*/
didUnload: EventEmitter<any>;
/**
@ -226,17 +255,7 @@ export class ViewController {
}
/**
* You can find out the index of the current view is in the current navigation stack.
*
* ```ts
* export class Page1 {
* constructor(private view: ViewController){
* // Just log out the index
* console.log(this.view.index);
* }
* }
* ```
*
* Get the index of the current component in the current navigation stack.
* @returns {number} Returns the index of this page within its `NavController`.
*/
get index(): number {
@ -387,20 +406,10 @@ export class ViewController {
}
/**
* You can find out of the current view has a Navbar or not. Be sure
*
* 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.
*
* ```ts
* export class Page1 {
* constructor(private viewCtrl: ViewController) {}
*
* ionViewWillEnter(){
* console.log('Do we have a Navbar?', this.viewCtrl.hasNavbar());
* }
*}
* ```
*
* @returns {boolean} Returns a boolean if this Page has a navbar or not.
*/
hasNavbar(): boolean {
@ -456,19 +465,8 @@ export class ViewController {
}
/**
* You can change the text of the back button on a view-by-view basis.
*
* ```ts
* export class MyClass{
* constructor(private viewCtrl: ViewController) {}
*
* ionViewWillEnter() {
* this.viewCtrl.setBackButtonText('Previous');
* }
* }
* ```
* Make sure you use the view events when calling this method, otherwise the back-button will not have been created
*
* Change the title of the back-button. Be sure to call this
* after `ionViewWillEnter` to make sure the DOM has been rendered.
* @param {string} backButtonText Set the back button text.
*/
setBackButtonText(val: string) {
@ -479,7 +477,8 @@ export class ViewController {
}
/**
* Set if the back button for the current view is visible or not. Be sure to wrap this in `ionViewWillEnter` to make sure the has been compleltly rendered.
* 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 {boolean} Set if this Page's back button should show or not.
*/
showBackButton(shouldShow: boolean) {

View File

@ -93,6 +93,7 @@ export class Picker extends ViewController {
/**
* @private
* @name PickerController
* @description
*

View File

@ -146,6 +146,15 @@ export class Popover extends ViewController {
* }
* }
* ```
* @advanced
* Popover Options
*
* | Option | Type | Description |
* |-----------------------|------------|------------------------------------------------------------------------------------------------------------------|
* | cssClass |`string` | An additional class for custom styles. |
* | showBackdrop |`boolean` | Whether to show the backdrop. Default true. |
* | enableBackdropDismiss |`boolean` | Whether the popover should be dismissed by tapping the backdrop. Default true. |
*
*
*
* @demo /docs/v2/demos/popover/
@ -156,15 +165,7 @@ export class PopoverController {
constructor(private _app: App) {}
/**
* Create a popover with the following options
*
* | Option | Type | Description |
* |-----------------------|------------|------------------------------------------------------------------------------------------------------------------|
* | cssClass |`string` | An additional class for custom styles. |
* | showBackdrop |`boolean` | Whether to show the backdrop. Default true. |
* | enableBackdropDismiss |`boolean` | Whether the popover should be dismissed by tapping the backdrop. Default true. |
*
*
* Present a popover. See below for options
* @param {object} componentType The Popover
* @param {object} data Any data to pass to the Popover view
* @param {PopoverOptions} opts Popover options

View File

@ -126,18 +126,7 @@ export class Toast extends ViewController {
* toast.present();
* }
* ```
*
* @demo /docs/v2/demos/toast/
*/
@Injectable()
export class ToastController {
constructor(private _app: App) {}
/**
*
* Toast options
*
* @advanced
* | Property | Type | Default | Description |
* |-----------------------|-----------|-----------------|---------------------------------------------------------------------------------------------------------------|
* | message | `string` | - | The message for the toast. Long strings will wrap and the toast container will expand. |
@ -148,6 +137,15 @@ export class ToastController {
* | closeButtonText | `string` | "Close" | Text to display in the close button. |
* | dismissOnPageChange | `boolean` | false | Whether to dismiss the toast when navigating to a new page. |
*
* @demo /docs/v2/demos/toast/
*/
@Injectable()
export class ToastController {
constructor(private _app: App) {}
/**
* Create a new toast component. See options below
* @param {ToastOptions} opts Toast options. See the above table for available options.
*/
create(opts: ToastOptions = {}) {

View File

@ -2,7 +2,9 @@ import {SlideGesture} from './slide-gesture';
import {defaults} from '../util/util';
import {windowDimensions} from '../util/dom';
/**
* @private
*/
export class SlideEdgeGesture extends SlideGesture {
public edges: Array<string>;
public maxEdgeStart: any;

View File

@ -2,6 +2,9 @@ import {DragGesture} from './drag-gesture';
import {clamp} from '../util';
/**
* @private
*/
export class SlideGesture extends DragGesture {
public slide: SlideData = null;

View File

@ -177,6 +177,9 @@ export function getQuerystring(url: string): any {
}
/**
* @private
*/
export function reorderArray(array: any[], indexes: {from: number, to: number}): any[] {
let element = array[indexes.from];
array.splice(indexes.from, 1);