The filter() operator lets you create a new Observable after omitting some of the data from the original Observable. It receives a function as argument that is called for each element in the original Observable, and it must return an either true or false (actually it can be any truthy or falsy value). If the result of the execution of filterFunction for an object is true, then this object will be propagated; otherwise, it will be omitted.
The filter() operator has the following signature:
observable.filter(filterFunction,[thisContext]);
The first parameter is mandatory and the second is optional:
- filterFunction: This is a function that takes an element of the observable as input and returns any truthy or falsy value. If the result of the execution of this function for a given object is true, then this object is propagated; otherwise, it is omitted.
- thisContext: This is any object to be used...