From 346fd18e0c3a7a2eac0ba26d9650cb7eb225ff70 Mon Sep 17 00:00:00 2001 From: smuddyx Date: Sun, 3 Apr 2022 13:26:17 +0200 Subject: [PATCH] filter artist --- .../modules/songs/song-list/filter/filter.component.ts | 10 +++++----- src/app/services/filter.helper.ts | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/app/modules/songs/song-list/filter/filter.component.ts b/src/app/modules/songs/song-list/filter/filter.component.ts index 83595e2..ecb6b35 100644 --- a/src/app/modules/songs/song-list/filter/filter.component.ts +++ b/src/app/modules/songs/song-list/filter/filter.component.ts @@ -37,11 +37,11 @@ export class FilterComponent { if (filterValues.flag) this.filterFormGroup.controls.flag.setValue(filterValues.flag); }); - this.filterFormGroup.controls.q.valueChanges.subscribe(_ => void this.filerValueChanged('q', _)); - this.filterFormGroup.controls.key.valueChanges.subscribe(_ => void this.filerValueChanged('key', _)); - this.filterFormGroup.controls.type.valueChanges.subscribe(_ => void this.filerValueChanged('type', _)); - this.filterFormGroup.controls.legalType.valueChanges.subscribe(_ => void this.filerValueChanged('legalType', _)); - this.filterFormGroup.controls.flag.valueChanges.subscribe(_ => void this.filerValueChanged('flag', _)); + this.filterFormGroup.controls.q.valueChanges.subscribe(_ => void this.filerValueChanged('q', _ as string)); + this.filterFormGroup.controls.key.valueChanges.subscribe(_ => void this.filerValueChanged('key', _ as string)); + this.filterFormGroup.controls.type.valueChanges.subscribe(_ => void this.filerValueChanged('type', _ as string)); + this.filterFormGroup.controls.legalType.valueChanges.subscribe(_ => void this.filerValueChanged('legalType', _ as string)); + this.filterFormGroup.controls.flag.valueChanges.subscribe(_ => void this.filerValueChanged('flag', _ as string)); } public getFlags(): string[] { diff --git a/src/app/services/filter.helper.ts b/src/app/services/filter.helper.ts index 4c5d0ef..44469c2 100644 --- a/src/app/services/filter.helper.ts +++ b/src/app/services/filter.helper.ts @@ -5,8 +5,9 @@ export function filterSong(song: Song, filterValue: string): boolean { const textMatch = !!song.text && normalize(song.text).indexOf(normalize(filterValue)) !== -1; const titleMatch = !!song.title && normalize(song.title).indexOf(normalize(filterValue)) !== -1; + const artistMatch = !!song.title && normalize(song.artist).indexOf(normalize(filterValue)) !== -1; - return textMatch || titleMatch; + return textMatch || titleMatch || artistMatch; } function normalize(input: string): string {