RxJS has static and instance statements:
static of interval instance map first
You can use them in a global Observable or observable instance as follows:
Observable.of() observableInstance.map()
To do this, you need to import the modules from the add package:
import 'rxjs/add/observable/of' import 'rxjs/add/operator/map'
When importing a module, it essentially fixes the prototype of the Observable class or Observable , adding a method that matches the operations.
But you can also import these statements directly and not install the Observable or observableInstance patch:
import { of } from 'rxjs/observable/of'; import { map } from 'rxjs/operator/map'; of() map.call(observableInstance)
With the implementation of lettable statements in RxJs @ 5.5, you should now use the built-in pipe method:
import { of } from 'rxjs/observable/of'; import { map } from 'rxjs/operators/map'; of().pipe(map(), ...)
More on RxJS: Understanding Lettable Statements
AngularInDepth.com
source share