Skip to content

Instantly share code, notes, and snippets.

@Ibro
Last active Apr 26, 2017
Embed
What would you like to do?
Implementing simple observer for observable - Coding Blast - www.codingblast.com
import { Observable, Observer } from 'rxjs';
let words = ['coding blast', 'coding', 'blast'];
let source = Observable.from(words);
class SimpleObserver implements Observer<string> {
next(value: string) {
console.log('next: ', value);
}
error(err: any) {
console.log('error: ', err);
}
complete() {
console.log('complete');
}
}
let observer = new SimpleObserver();
source.subscribe(observer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment