diff --git a/src/components/content/content.ts b/src/components/content/content.ts index 9619eff549..efe3b25df0 100644 --- a/src/components/content/content.ts +++ b/src/components/content/content.ts @@ -44,6 +44,61 @@ import { isTrueProperty } from '../../util/util'; * } * ``` * + * @advanced + * + * Resizing the content + * + * + * ```ts + * @Component({ + * template: ` + * + * + * Main Navbar + * + * + * Dynamic Toolbar + * + * + * + * + * + * `}) + * + * class E2EPage { + * @ViewChild(Content) content: Content; + * showToolbar: boolean = false; + * + * toggleToolbar() { + * this.showToolbar = !this.showToolbar; + * this.content.resize(); + * } + * } + * ``` + * + * + * Scroll to a specific position + * + * ```ts + * import { Component, ViewChild } from '@angular/core'; + * import { Content } from 'ionic-angular'; + * + * @Component({ + * template: ` + * + * ` + * )} + * export class MyPage{ + * @ViewChild(Content) content: Content; + * + * scrollTo() { + * // set the scrollLeft to 0px, and scrollTop to 500px + * // the scroll duration should take 200ms + * this.content.scrollTo(0, 500, 200); + * } + * } + * ``` + * */ @Component({ selector: 'ion-content', @@ -244,25 +299,6 @@ export class Content extends Ion { /** * Scroll to the specified position. * - * ```ts - * import { Component, ViewChild } from '@angular/core'; - * import { Content } from 'ionic-angular'; - * - * @Component({ - * template: ` - * - * ` - * )} - * export class MyPage{ - * @ViewChild(Content) content: Content; - * - * scrollTo() { - * // set the scrollLeft to 0px, and scrollTop to 500px - * // the scroll duration should take 200ms - * this.content.scrollTo(0, 500, 200); - * } - * } - * ``` * @param {number} x The x-value to scroll to. * @param {number} y The y-value to scroll to. * @param {number} [duration] Duration of the scroll animation in milliseconds. Defaults to `300`. @@ -275,23 +311,6 @@ export class Content extends Ion { /** * Scroll to the top of the content component. * - * ```ts - * import { Component, ViewChild } from '@angular/core'; - * import { Content } from 'ionic-angular'; - * - * @Component({ - * template: ` - * - * ` - * )} - * export class MyPage{ - * @ViewChild(Content) content: Content; - * - * scrollToTop() { - * this.content.scrollToTop(); - * } - * } - * ``` * @param {number} [duration] Duration of the scroll animation in milliseconds. Defaults to `300`. * @returns {Promise} Returns a promise which is resolved when the scroll has completed. */ @@ -446,33 +465,6 @@ export class Content extends Ion { * Tell the content to recalculate its dimensions. This should be called * after dynamically adding headers, footers, or tabs. * - * ```ts - * @Component({ - * template: ` - * - * - * Main Navbar - * - * - * Dynamic Toolbar - * - * - * - * - * - * `}) - * - * class E2EPage { - * @ViewChild(Content) content: Content; - * showToolbar: boolean = false; - * - * toggleToolbar() { - * this.showToolbar = !this.showToolbar; - * this.content.resize(); - * } - * } - * ``` - * */ resize() { nativeRaf(() => {