Filtering object with multiple inputs


#1

I’m current working on an app where i’m displaying a list of items fetched from a mongodb. What i want to do is being able to filter these results based on a single property of this object, but with multiple options.

An example would be to search for everyone with the name John or Morgan

I’ve found ng-pipes https://github.com/a8m/angular-filter#filterby (the Angular 2 version of Angular-filter) which contains filterBy, but that pipe only accepts a single search term. So i can only get results with names that are either John or Morgan - not a combined result with both. And i i’ve accepted that i have to go a different way to achieve this, but how?

I would love to be able to do something like this:

test() {
    this.stores = this.filterBy.transform(this.stores, ["obj.name"], "Morgan" || "John");
}

Any hints as to how i could, somehow, do this in a simple way?