diff --git a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.spec.ts b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.spec.ts index 899d254285..87677017e6 100644 --- a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.spec.ts +++ b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.spec.ts @@ -38,7 +38,7 @@ import { DialogHeaderComponent } from '../../custom/dialog-header/dialog-header. import { TranslateTestingModule } from 'ngx-translate-testing'; import * as de from '../../../../assets/i18n/de.json'; import { ActivatedRoute } from '@angular/router'; -import { MatAutocomplete } from '@angular/material/autocomplete'; +import { MatAutocompleteModule } from '@angular/material/autocomplete'; import { AlignmentPossibility } from '../../types/model/AlignmentPossibility'; import { ElementRef } from '@angular/core'; @@ -104,7 +104,7 @@ describe('ObjectiveDialogComponent', () => { MatSelectModule, ReactiveFormsModule, MatInputModule, - MatAutocomplete, + MatAutocompleteModule, NoopAnimationsModule, MatCheckboxModule, RouterTestingModule, @@ -472,7 +472,7 @@ describe('ObjectiveDialogComponent', () => { MatSelectModule, ReactiveFormsModule, MatInputModule, - MatAutocomplete, + MatAutocompleteModule, NoopAnimationsModule, MatCheckboxModule, RouterTestingModule, @@ -666,7 +666,7 @@ describe('ObjectiveDialogComponent', () => { MatSelectModule, ReactiveFormsModule, MatInputModule, - MatAutocomplete, + MatAutocompleteModule, NoopAnimationsModule, MatCheckboxModule, RouterTestingModule, diff --git a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts index a8e4b8e09b..7725c7ca2f 100644 --- a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts +++ b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts @@ -297,9 +297,9 @@ export class ObjectiveFormComponent implements OnInit { } filter() { - let filterValue = this.input.nativeElement.value.toLowerCase(); + let filterValue: string = this.input.nativeElement.value.toLowerCase(); this.alignmentPossibilities$.subscribe((alignmentPossibilities: AlignmentPossibility[]) => { - let matchingTeams = alignmentPossibilities.filter((possibility: AlignmentPossibility) => + let matchingTeams: AlignmentPossibility[] = alignmentPossibilities.filter((possibility: AlignmentPossibility) => possibility.teamName.toLowerCase().includes(filterValue), ); @@ -327,7 +327,7 @@ export class ObjectiveFormComponent implements OnInit { ), })); - let finalArray = matchingTeams.concat(optionList); + let finalArray: AlignmentPossibility[] = filterValue == '' ? matchingTeams : matchingTeams.concat(optionList); this.filteredOptions$.next([...new Set(finalArray)]); }); }