Created
April 29, 2017 03:01
-
-
Save Ibro/357c7a0dae797390d092001d1776b079 to your computer and use it in GitHub Desktop.
RxJS - Observeable in map function - Coding Blast - www.codingblast.com
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'; | |
let source = Observable | |
.interval(100) // interval starts from 0 | |
.take(5) // take first 5 | |
.map(n => { | |
let observable = Observable.of(n + 10); | |
// we now have an observable here, not a number! | |
return observable; | |
}); | |
source.subscribe((value) => { | |
console.log('in next. Value: ', value); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment