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`:
*
* ```html
* <ion-tabs id="myTabs">
* <ion-tabs #myTabs>
* <ion-tab [root]="tab1Root"></ion-tab>
* <ion-tab [root]="tab2Root"></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()`,
* passing the index of the tab as the argument. In the following code `app` is
* of type [`IonicApp`](../../app/IonicApp/):
* passing the index of the tab as the argument. Here we're grabbing the tabs
* by using ViewChild.
*
*```ts
* constructor(app: IonicApp) {
* this.app = app;
* constructor() {
* @ViewChild('myTabs) tabRef: Tabs
* }
*
* onPageDidEnter() {
* let tabs = this.app.getComponent('myTabs');
* tabs.select(2);
* this.tabRef.select(2);
* }
*```
*