Introduction
RxJS is
a framework for reactive programming that makes use of Observables,
making it really easy to write asynchronous code.
What is Pipe Operator
RxJS
pipe
is used to combine functional operators into a chain. pipe
is an instance method of Observable
as well as a standalone RxJS function.pipe
can be used as Observable.pipe
or we can use standalone pipe
to combine functional operators.pipe
accepts operators as arguments such as filter
, map
, mergeScan
etc. with comma separated and execute them in a sequence they are
passed in as arguments and finally returns Observable
instance.
To get the result we need to
subscribe
the final Observable
response.
Please find the sample code below
Output will be 11, 13, 15, 17.
Happy programming!!
Don’t forget to leave your feedback and comments below!
Regards
Sujeet Bhujbal
--------------------------------------------------------------------------------
------------------------------------------------------------------------------
No comments:
Post a Comment