From b5abf7da6206948f8cbfe86382b33d061087e9c9 Mon Sep 17 00:00:00 2001 From: Angelika Kinas Date: Wed, 8 Nov 2023 14:32:26 +0100 Subject: [PATCH] fix(libs): Add manual change detection in ngAfterViewInit --- libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts b/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts index 24e5e65971..8a9040ca4d 100644 --- a/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts +++ b/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts @@ -1,6 +1,7 @@ import { AfterViewInit, ChangeDetectionStrategy, + ChangeDetectorRef, Component, ElementRef, EventEmitter, @@ -65,6 +66,7 @@ export class AutocompleteComponent @Input() displayWithFn: (AutocompleteItem) => string = (item) => item + constructor(private cdRef: ChangeDetectorRef) {} ngOnChanges(changes: SimpleChanges): void { const { value } = changes if (value) { @@ -109,8 +111,8 @@ export class AutocompleteComponent } ngAfterViewInit(): void { - this.inputRef.nativeElement.focus() this.autocomplete.optionSelected.subscribe(this.selectionSubject) + this.cdRef.detectChanges() } ngOnDestroy(): void {