docs(tabs): update to use ViewChild

This commit is contained in:
Mike Hartington
2016-04-29 12:47:07 -04:00
parent 41174f6b27
commit aa7c0bfb1f

View File

@ -103,7 +103,7 @@ import {isBlank, isTrueProperty} from '../../util/util';
* example, set the value of `id` to `myTabs`: * example, set the value of `id` to `myTabs`:
* *
* ```html * ```html
* <ion-tabs id="myTabs"> * <ion-tabs #myTabs>
* <ion-tab [root]="tab1Root"></ion-tab> * <ion-tab [root]="tab1Root"></ion-tab>
* <ion-tab [root]="tab2Root"></ion-tab> * <ion-tab [root]="tab2Root"></ion-tab>
* <ion-tab [root]="tab3Root"></ion-tab> * <ion-tab [root]="tab3Root"></ion-tab>
@ -111,17 +111,16 @@ import {isBlank, isTrueProperty} from '../../util/util';
* ``` * ```
* *
* Then in your class 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 * passing the index of the tab as the argument. Here we're grabbing the tabs
* of type [`IonicApp`](../../app/IonicApp/): * by using ViewChild.
* *
*```ts *```ts
* constructor(app: IonicApp) { * constructor() {
* this.app = app; * @ViewChild('myTabs) tabRef: Tabs
* } * }
* *
* onPageDidEnter() { * onPageDidEnter() {
* let tabs = this.app.getComponent('myTabs'); * this.tabRef.select(2);
* tabs.select(2);
* } * }
*``` *```
* *