I want to write a generic filter in angular 7 to perform search filter operation on any field in any number of screens. I have found some links suggesting writing custom pipe filters but they always filter based on particular static field.
To explain more, I have around 20 screens in my project. Each screen is making an API call , fetching data and displaying on the UI ,like one is device screen showing data for fields:
deviceId, deviceHardwareNumber, deviceSoftwareNumber, deviceVendor, devicePurchaseDate
Another screen for deviceServiceDetails
deviceId, deviceServiceProvider, deviceServiceDate, nextServiceDueDate
Now either I can write 20 filters for 20 screens for filtering on different field names or is there any way possible for writing only one filter for all the screens and filtering on any field.
Is there a way to make it dynamic by writing one filter irrespective of the number of screens, i.e. any list or searchText passed from any screen should be filtered and returned?