Angular 4 Filter Search Custom Pipe

后端 未结 6 1876
清歌不尽
清歌不尽 2020-11-28 15:14

So I am trying to build a custom pipe to do a search filter of multiple values in a ngFor loop. I have looked for a number of hours for a good working example, and most of t

6条回答
  •  野性不改
    2020-11-28 15:32

    A simple Java-like logic that I could think of which might not look very compact in terms of typescript, is as below:

    transform(value:IBook[], keyword:string) {       
            if(!keyword)
            return value;
            let filteredValues:any=[];      
            for(let i=0;i

    Available Books

    • {{book.name}}

提交回复
热议问题