angular-cn/public/docs/js/latest/api/pipes/PromisePipe-class.jade
2015-06-01 23:18:32 -07:00

96 lines
1.4 KiB
Plaintext

p.location-badge.
exported from <a href='../pipes'>angular2/pipes</a>
defined in <a href="https://github.com/angular/angular/tree/master/modules/angular2/src/change_detection/pipes/promise_pipe.ts#L4-L82">angular2/src/change_detection/pipes/promise_pipe.ts (line 4)</a>
:markdown
Implements async bindings to Promise.
# Example
In this example we bind the description promise to the DOM.
The async pipe will convert a promise to the value with which it is resolved. It will also
request a change detection check when the promise is resolved.
```
@Component({
selector: "task-cmp",
changeDetection: ON_PUSH
})
@View({
template: "Task Description {{ description | async }}"
})
class Task {
description:Promise<string>;
}
```
.l-main-section
h2 Members
.l-sub-section
h3 constructor
pre.prettyprint
code.
constructor(ref: ChangeDetectorRef)
:markdown
.l-sub-section
h3 onDestroy
pre.prettyprint
code.
onDestroy()
:markdown
.l-sub-section
h3 supports
pre.prettyprint
code.
supports(promise)
:markdown
.l-sub-section
h3 transform
pre.prettyprint
code.
transform(promise: Promise&lt;any&gt;)
:markdown