I have an Observable array and I want to filter it by some properties. However, the filtering doesn't working.
I tried debugging the code but it's like it doesn't go into the pipe(map(... section.
ngOnInit() {
this.bookService.getBooks().subscribe(res => {
this.store.dispatch(listBooks({ books: res }));
});
this.filterForm = this.formBuilder.group({
name: [""],
author: [""],
release_year: [""]
});
this.filterForm.valueChanges.subscribe(val => {
this.books$.pipe(map(books =>
books.filter(b => {
return b.name.startsWith(val.name) &&
b.author.startsWith(val.author) &&
b.release_year.startsWith(val.release_year)
})
))
})