I make a call to a method called getWorkOrders() in my service file which in turn makes a call to the server to fetch the records.
Here is my service. I am using the new HttpClient.
export class BackendServices {
private BASE_URL ='http://localhost:3000/backend';
constructor(private http: HttpClient) {}
getWorkOrders(){
return this.http.get(this.BASE_URL + '/getworkorders/');
}
}
Component.ts file
private woSubject = new BehaviorSubject<IWorkOrders[]>([]);
getWorkOrders() {
this.bs.getWorkOrders()
.subscribe((data: any) =>
this.woSubject.next(data),
);
}
From the component getWorkOrders method how do I filter the data from all the records that was fetched from the server. I understand that it is using pipe & the filter rxjs operators, but not sure how to put it together.