RxJS Operators In 🖲️ Angular

In this blog, I'm going to explore the use of RxJS operators. As a beginner developer, we hear a lot about Promise/Observables/Subscription to call asynchronous services and perform data operations using traditional means, such as - loops, custom property mapper, and class models and so on. Instead, we can use various RxJS operators which are very easy and simple to write. In this blog, I will be demonstrating some of the real-time use cases of our day to day work and handling complex response in an easy way.

of() is used for converting the string/objects to Observables.
 
  1. ngOnInit() {    
  2.     
  3.     const employee = {    
  4.       name: 'Rajendra'    
  5.     };    
  6.     const obsEmployee: Observable<any>  = of(employee);    
  7.     obsEmployee.subscribe((data) => { console.log(data); });    
  8.     
  9.   }    
 

Recommended Ebook

Hands-On With AngularJS Using ASP.NET

Download Now!
Similar Articles