码迷,mamicode.com
首页 > 其他好文 > 详细

[Angular 2] Rendering an Observable with the Async Pipe

时间:2016-04-26 07:04:47      阅读:312      评论:0      收藏:0      [点我收藏+]

标签:

Angular 2 templates use a special Async pipe to be able to render out Observables. This lesson covers the syntax used to create an Observable in Angular 2 and then to render it out in the template.

 

import {Component} from angular2/core;
import {bootstrap} from angular2/platform/browser;
import {Observable} from rxjs/Observable;
import rxjs/add/observable/interval

@Component({
    selector: app,
    template: `<h1>{{clock | async}}</h1>`
})

class App {
    clock = Observable.interval(1000);
}

bootstrap(App);

 

[Angular 2] Rendering an Observable with the Async Pipe

标签:

原文地址:http://www.cnblogs.com/Answer1215/p/5433549.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!