rxjs observable do code example
Example 1: understanding Observable.create(
import { Observable } from "rxjs/Observable";
var observable = Observable.create(function subscribe(observer) {
observer.next('Hey guys!')
})
// OR
var observable = Observable.create((observer:any) => {
observer.next('Hey guys!')
})
Example 2: rxjs promise to observable
import { from } from 'rxjs';
const observable = from(promise);