docs(content): add @ViewChild example to usage

This commit is contained in:
Adam Bradley
2016-04-12 11:46:28 -05:00
parent 918aa456da
commit 79cfa6f407

View File

@@ -4,15 +4,15 @@ import {Ion} from '../ion';
import {IonicApp} from '../app/app';
import {Config} from '../../config/config';
import {Keyboard} from '../../util/keyboard';
import {raf, transitionEnd} from '../../util/dom';
import {raf, nativeTimeout, transitionEnd} from '../../util/dom';
import {ViewController} from '../nav/view-controller';
import {ScrollView} from '../../util/scroll-view';
/**
* @name Content
* @description
* The Content component provides an easy to use content area with some useful
* methods to control the scrollable area.
* The Content component provides an easy to use content area with
* some useful methods to control the scrollable area.
*
* The content area can also implement pull-to-refresh with the
* [Refresher](../../scroll/Refresher) component.
@@ -24,6 +24,23 @@ import {ScrollView} from '../../util/scroll-view';
* </ion-content>
* ```
*
* To get a reference to the content component from a Page's logic,
* you can use Angular's `@ViewChild` annotation:
*
* ```ts
* import {ViewChild} from 'angular2/core';
* import {Content} from 'ionic-angular';
*
* @Page({...}
* export class MyPage{
* @ViewChild(Content) content: Content;
*
* scrollToTop() {
* this.content.scrollToTop();
* }
* }
* ```
*
*/
@Component({
selector: 'ion-content',
@@ -181,7 +198,7 @@ export class Content extends Ion {
});
}
setTimeout(next, 100);
nativeTimeout(next, 100);
}
/**