angularjs - How make multicolumns pipes filter? -


i have such paipe , work column: name author no longer.

 export class filterbook2 implements pipetransform {

transform(items: book[], filter: book): { if (!items || !filter) { return items; } // filter items array, items match , return true kept, false filtered out return items.filter((item) => item.nazwa.indexof(filter.nazwa) || item.autor.indexof(filter.autor) !== -1) }

}

input date:

filterargs = { nazwa: "", autor: "" }

i think trying filter books multiple arguments. can pass multiple values pipe transform function this:

<div *ngfor="let book of books | filterbook2 : firstarg : secondarg">     ... </div> 

and in pipe class

export class filterbook2 implements pipetransform {    transform(items: book[], firstarg: book, secondarg: any): {        // logic here    } } 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -