File tree Expand file tree Collapse file tree 2 files changed +13
-14
lines changed
modules/angular2/src/core Expand file tree Collapse file tree 2 files changed +13
-14
lines changed Original file line number Diff line number Diff line change 11/**
22 * @module
33 * @description
4- * This module provides advanced support for extending change detection .
4+ * This module provides a set of common Pipes .
55 */
66
77export { AsyncPipe } from './pipes/async_pipe' ;
Original file line number Diff line number Diff line change @@ -36,28 +36,27 @@ var _observableStrategy = new ObservableStrategy();
3636
3737
3838/**
39- * Implements async bindings to Observable and Promise.
39+ * The `async` pipe subscribes to an Observable or Promise and returns the latest value it has
40+ * emitted.
41+ * When a new value is emitted, the `async` pipe marks the component to be checked for changes.
4042 *
4143 * # Example
44+ * The example below binds the `time` Observable to the view. Every 500ms, the `time` Observable
45+ * updates the view with the current time.
4246 *
43- * In this example we bind the description observable to the DOM. The async pipe will convert an
44- *observable to the
45- * latest value it emitted. It will also request a change detection check when a new value is
46- *emitted.
47- *
48- * ```
47+ * import {Observable} from 'angular2/core';
4948 * @Component ({
50- * selector: "task-cmp",
51- * changeDetection: ChangeDetectionStrategy.OnPush
49+ * selector: "task-cmp"
5250 * })
5351 * @View ({
54- * template: "Task Description {{ description | async }}"
52+ * template: "Time: {{ time | async }}"
5553 * })
5654 * class Task {
57- * description:Observable<string>;
55+ * time = new Observable<number>(observer => {
56+ * setInterval(_ =>
57+ * observer.next(new Date().getTime(), 500);
58+ * });
5859 * }
59- *
60- * ```
6160 */
6261@Pipe ( { name : 'async' , pure : false } )
6362@Injectable ( )
You can’t perform that action at this time.
0 commit comments