How do I filter an array with TypeScript in Angular 2?

前端 未结 3 1598
耶瑟儿~
耶瑟儿~ 2020-12-04 11:56

ng-2 parent-child data inheritance has been a difficulty for me.

What seems that could be a fine working practical solution is filtering my total array of data to a

3条回答
  •  抹茶落季
    2020-12-04 12:22

    You can check an example in Plunker over here plunker example filters

    filter() {
    
        let storeId = 1;
        this.bookFilteredList = this.bookList
                                    .filter((book: Book) => book.storeId === storeId);
        this.bookList = this.bookFilteredList; 
    }
    

提交回复
热议问题