Created
October 2, 2017 18:26
-
-
Save AustinMatherne/2a4498e4b19dd411a95dc09fb4f9c396 to your computer and use it in GitHub Desktop.
Multiple Async Pipes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Observable} from 'rxjs/Observable'; | |
import {defer} from 'rxjs/observable/defer'; | |
import {of} from 'rxjs/observable/of'; | |
@Component({ | |
selector: 'my-app', | |
template: ` | |
<div> | |
Data: {{data$ | async}} <!-- 0.2762838374749106 --> | |
</div> | |
<div> | |
Data: {{data$ | async}} <!-- 0.4848979749053728 --> | |
</div> | |
`, | |
}) | |
export class App { | |
data$: Observable<number> = defer(() => of(Math.random())); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment