Hello there, I am currently using Angular version 16 with ngx-bootstrap version 11.0.2.
I am facing an issue where I cannot set a default value for a control. When a user selects data from a suggestive search and it gets saved in the database, I want that selected value to be pre-filled when the control is loaded. Below is the HTML code snippet:
I have implemented [typeaheadAsync]="true"
<input [(ngModel)]="search"
typeaheadOptionField="AgencySearchText"
[typeahead]="suggestions$"
[typeaheadAsync]="true"
[typeaheadMinLength]="4"
[optionsListTemplate]="customListTemplate"
class="form-control"
[name]="label"
(keydown)="onTypeaheadKeyPress($event)"
(typeaheadOnSelect)="typeaheadOnSelect($event)"
[required]="required"
[disabled]="disabled">
ngOnInit(): void {
this.suggestions$ = new Observable((observer: Observer<string | undefined>) => {
observer.next(this.search);
}).pipe(
switchMap((query: string) => {
if (query && query.length > 3) {
return this.srvAgency.GetSearchAgencyLookup(query)
}
return of([]);
})
);
}
I have searched on the official site for examples, but unfortunately could not find one related to my issue. You can check out their website here: .