diff --git a/modules/angular2/src/core/pipes.ts b/modules/angular2/src/core/pipes.ts index a597f8c891..2b918fe845 100644 --- a/modules/angular2/src/core/pipes.ts +++ b/modules/angular2/src/core/pipes.ts @@ -1,7 +1,7 @@ /** * @module * @description - * This module provides advanced support for extending change detection. + * This module provides a set of common Pipes. */ export {AsyncPipe} from './pipes/async_pipe'; diff --git a/modules/angular2/src/core/pipes/async_pipe.ts b/modules/angular2/src/core/pipes/async_pipe.ts index 43de5c26aa..6f2203783a 100644 --- a/modules/angular2/src/core/pipes/async_pipe.ts +++ b/modules/angular2/src/core/pipes/async_pipe.ts @@ -36,28 +36,27 @@ var _observableStrategy = new ObservableStrategy(); /** - * Implements async bindings to Observable and Promise. + * The `async` pipe subscribes to an Observable or Promise and returns the latest value it has + * emitted. + * When a new value is emitted, the `async` pipe marks the component to be checked for changes. * * # Example + * The example below binds the `time` Observable to the view. Every 500ms, the `time` Observable + * updates the view with the current time. * - * In this example we bind the description observable to the DOM. The async pipe will convert an - *observable to the - * latest value it emitted. It will also request a change detection check when a new value is - *emitted. - * - * ``` + * import {Observable} from 'angular2/core'; * @Component({ - * selector: "task-cmp", - * changeDetection: ChangeDetectionStrategy.OnPush + * selector: "task-cmp" * }) * @View({ - * template: "Task Description {{ description | async }}" + * template: "Time: {{ time | async }}" * }) * class Task { - * description:Observable; + * time = new Observable(observer => { + * setInterval(_ => + * observer.next(new Date().getTime(), 500); + * }); * } - * - * ``` */ @Pipe({name: 'async', pure: false}) @Injectable()