Created
April 9, 2017 04:20
-
-
Save rahulsahay19/e15300d3ff7c8647e50dfb405c98f0d2 to your computer and use it in GitHub Desktop.
main.ts
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"; | |
//Creating new Datasource using that API. | |
let nums = [0,1,2,3,4,5,6,7,8,9]; | |
//Now passed this array as datasource in observable. | |
let dataSource = Observable.from(nums); | |
//Creating observer | |
class customObserver{ | |
next(value){ | |
console.log(`Incoming Value:- ${value}`); | |
} | |
error(e){ | |
console.log(`Error Happend:- $(e)`); | |
} | |
complete(){ | |
console.log("We are done!!!"); | |
} | |
} | |
//Subscribing observer | |
dataSource.subscribe(new customObserver()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment