diff --git a/ionic/components/tabs/tabs.ts b/ionic/components/tabs/tabs.ts index 8134f1f460..124889b6d2 100644 --- a/ionic/components/tabs/tabs.ts +++ b/ionic/components/tabs/tabs.ts @@ -47,7 +47,44 @@ import {isBlank, isTrueProperty} from '../../util/util'; * * There are different ways you can select a specific tab from the tabs * component. You can use the `selectedIndex` property to set the index - * on creation of the tabs: + * on the `` element, or you can call `select()` from the `Tabs` + * instance after creation. See usage below for more information. + * + * @usage + * + * You can add a basic tabs template to a `@Page` using the following + * template: + * + * ```html + * + * + * + * + * + * ``` + * + * Where `tab1Root`, `tab2Root`, and `tab3Root` are each a page: + * + *```ts + * @Page({ + * templateUrl: 'build/pages/tabs/tabs.html' + * }) + * export class TabsPage { + * // this tells the tabs component which Pages + * // should be each tab's root Page + * tab1Root = Page1; + * tab2Root = Page2; + * tab3Root = Page3; + * + * constructor() { + * + * } + * } + *``` + * + * By default, the first tab will be selected upon navigation to the + * Tabs page. We can change the selected tab by using `selectedIndex` + * on the `` element: * * ```html * @@ -58,9 +95,12 @@ import {isBlank, isTrueProperty} from '../../util/util'; * ``` * * Since the index starts at `0`, this will select the 3rd tab which has - * root set to `tab3Root`. You can also grab the `Tabs` instance and call - * the `select()` method. This requires the `` element to have - * an `id`. For example, set the value of `id` to `myTabs`: + * root set to `tab3Root`. If you wanted to change it dynamically from + * your class, you could use [property binding](https://angular.io/docs/ts/latest/guide/template-syntax.html#!#property-binding). + * + * Alternatively, you can grab the `Tabs` instance and call the `select()` + * method. This requires the `` element to have an `id`. For + * example, set the value of `id` to `myTabs`: * * ```html * @@ -70,11 +110,11 @@ import {isBlank, isTrueProperty} from '../../util/util'; * * ``` * - * Then in your JavaScript you can grab the `Tabs` instance and call `select()`, + * Then in your class you can grab the `Tabs` instance and call `select()`, * passing the index of the tab as the argument. In the following code `app` is * of type [`IonicApp`](../../app/IonicApp/): * - *```js + *```ts * constructor(app: IonicApp) { * this.app = app; * } @@ -85,16 +125,6 @@ import {isBlank, isTrueProperty} from '../../util/util'; * } *``` * - * - * @usage - * ```html - * - * - * - * - * - * ``` - * * @demo /docs/v2/demos/tabs/ * * @see {@link /docs/v2/components#tabs Tabs Component Docs}