bugfixing
This commit is contained in:
@@ -30,12 +30,22 @@ export class FilterComponent implements OnInit {
|
||||
});
|
||||
|
||||
activatedRoute.queryParams.subscribe((filterValues: FilterValues) => {
|
||||
if (filterValues.q) this.filterFormGroup.controls.q.setValue(filterValues.q);
|
||||
if (filterValues.type) this.filterFormGroup.controls.type.setValue(filterValues.type);
|
||||
if (filterValues.key) this.filterFormGroup.controls.key.setValue(filterValues.key);
|
||||
if (filterValues.legalType) this.filterFormGroup.controls.legalType.setValue(filterValues.legalType);
|
||||
if (filterValues.flag) this.filterFormGroup.controls.flag.setValue(filterValues.flag);
|
||||
})
|
||||
if (filterValues.q) {
|
||||
this.filterFormGroup.controls.q.setValue(filterValues.q);
|
||||
}
|
||||
if (filterValues.type) {
|
||||
this.filterFormGroup.controls.type.setValue(filterValues.type);
|
||||
}
|
||||
if (filterValues.key) {
|
||||
this.filterFormGroup.controls.key.setValue(filterValues.key);
|
||||
}
|
||||
if (filterValues.legalType) {
|
||||
this.filterFormGroup.controls.legalType.setValue(filterValues.legalType);
|
||||
}
|
||||
if (filterValues.flag) {
|
||||
this.filterFormGroup.controls.flag.setValue(filterValues.flag);
|
||||
}
|
||||
});
|
||||
|
||||
this.filterFormGroup.controls.q.valueChanges.subscribe(_ => this.filerValueChanged('q', _));
|
||||
this.filterFormGroup.controls.key.valueChanges.subscribe(_ => this.filerValueChanged('key', _));
|
||||
|
||||
@@ -38,8 +38,8 @@ export class SongListComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.songs$ = combineLatest([filter$, songs$]).pipe(
|
||||
map(_ => {
|
||||
let songs = _[1];
|
||||
let filter = _[0];
|
||||
const songs = _[1];
|
||||
const filter = _[0];
|
||||
this.anyFilterActive = this.checkIfFilterActive(filter);
|
||||
return songs.filter(song => this.filter(song, filter));
|
||||
})
|
||||
@@ -68,10 +68,14 @@ export class SongListComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private checkFlag(flag: string, flags: string) {
|
||||
if (!flags) return false;
|
||||
if (!flags) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const flagStrings = flags.split(';');
|
||||
if (flagStrings.length === 0) return false;
|
||||
if (flagStrings.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return flagStrings.indexOf(flag) !== -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user