View main.ts
import {Observable} from "rxjs";
//Creating new Datasource using that API.
let nums = [0,1,2,3,4,5,6,7,8,9];
//createing Observable
let dataSource = Observable.create(ob=>{
//loop through the nums
for(let n of nums){
View main.ts
import {Observable} from "rxjs";
//Creating new Datasource using that API.
let nums = [0,1,2,3,4,5,6,7,8,9];
//createing Observable
let dataSource = Observable.create(ob=>{
//loop through the nums
for(let n in nums){
View main.ts
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);
//Simplest way of building an observer, where in passing all three functions directly.
dataSource.subscribe(
View main.ts
import {Observable, Observer} 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 via implementing Observer interface
View main.ts
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
View home.html
<html>
<head>
<title>
RX JS Demo
</title>
</head>
<body>
<div>Welcome at Reactive Components! </div>
<script src="app.js"></script>
</body>
View package.json
{
"name": "rxjs-demo",
"version": "1.0.0",
"description": "",
"scripts": {
"start": "webpack-dev-server --watch --inline",
"postinstall": "typings install"
},
"keywords": [
"RXJS"
View webpack.config.js
module.exports = {
entry: "./main",
output: { filename: "app.js" },
module: {
loaders: [
{
test: /.ts$/,
loader: "ts-loader"
}
]
View tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true
}
}
View package.json
{
"name": "rxjs-demo",
"version": "1.0.0",
"description": "RXJS Demo",
"scripts": {},
"keywords": [
"RXJS"
],
"author": "Rahul Sahay",
"license": "ISC",