I noticed in my angular app that rxjs operators, like switchMap, map etc, were not working. (My IDE also gives a hint about that.) To be sure, I ran the following code. If I replace switchMap with subscribe, I do see 'value returned' in the console.
Any idea why the operators are not working?
import { Component, OnInit } from '@angular/core';
import {Observable} from "rxjs/Observable";
import 'rxjs/add/operator/switchMap';
@Component({
selector: 'page-2',
template: `
<h2>{{title}}</h2>
`,
})
export class Page2Component implements OnInit{
title = 'Page2';
ngOnInit() {
let obs = new Observable(observable => {
observable.next('value returned');
});
obs.switchMap(console.log);
}
}