Skip to content

Commit

Permalink
fix(libs): Add manual change detection in ngAfterViewInit
Browse files Browse the repository at this point in the history
  • Loading branch information
Angi-Kinas committed Nov 8, 2023
1 parent b116a3d commit b5abf7d
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
AfterViewInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ElementRef,
EventEmitter,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -109,8 +111,8 @@ export class AutocompleteComponent
}

ngAfterViewInit(): void {
this.inputRef.nativeElement.focus()
this.autocomplete.optionSelected.subscribe(this.selectionSubject)
this.cdRef.detectChanges()
}

ngOnDestroy(): void {
Expand Down

0 comments on commit b5abf7d

Please sign in to comment.