标签:png style scribe init 操作符 com const struct color
把多个 Observables 的值混合到一个 Observable 中
import { Component, OnInit } from ‘@angular/core‘; import { of } from ‘rxjs/observable/of‘; import { range } from ‘rxjs/observable/range‘; import { merge } from ‘rxjs/observable/merge‘; import { Observable } from ‘rxjs/Observable‘; @Component({ selector: ‘app-combine‘, templateUrl: ‘./combine.component.html‘, styleUrls: [‘./combine.component.css‘] }) export class CombineComponent implements OnInit { constructor() { } ngOnInit() { const low: Observable<number> = range(100, 3); const middle: Observable<number> = range(200, 3); const high: Observable<number> = range(300, 3); merge(low, middle, high).subscribe((val: number) => { console.log(val); }); } }
标签:png style scribe init 操作符 com const struct color
原文地址:https://www.cnblogs.com/sea-breeze/p/8969158.html