标签:config from ble ice 延迟 out term console 就是
1.响应式编程
例子
import {Observable} from "rxjs/Observable";
Observable.from([1,2,3,4])
.filter((item)=>item%2==0)
.map(e=>e*e)
.subscribe(
e=>console.log(e),
err=>console.error(err),
()=>console.log("结束了")
)
例子
延迟400毫秒搜索
1.模块引入
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
imports: [
BrowserModule,
RouterModule.forRoot(routerConfig),
ReactiveFormsModule
],
2. 定义FormControl对象
private searchInput:FormControl = new FormControl();
3.绑定formcontrol对象
<input (keyup)="onKey($event)" [formControl]="searchInput">
4.formControl的值发生改变,就是发射流事件
constructor(private productService:ProductService) {
this.searchInput.valueChanges
.debounceTime(500)
.subscribe(
item=>this.getitem()
)
}
标签:config from ble ice 延迟 out term console 就是
原文地址:http://www.cnblogs.com/norm/p/8016200.html