NgbTypeahead leave incomplete text

20 Views Asked by At

So I have the following input

<input
                id="agency"
                type="text"
                name="agency"
                class="form-control"
                formControlName="agency"
                [ngClass]="{ 'read-only': viewPage }"
                [ngbTypeahead]="searchAgency"
                [resultFormatter]="resultFormatAgencyListValue"
                [inputFormatter]="inputFormatAgencyListValue"
                [editable]="false"
                [showHint]="true"
                #instance="ngbTypeahead"
                (selectItem)="onSelectItem($event, agencyInput)"
                placeholder="{{
                  '::Contract:AgencyPlaceHolder' | abpLocalization
                }}"
                #agencyInput />

Everything is working as expected, except when the user writes something and does not complete or select an option and clicks outside the input, it leaves the input incomplete.

Example:

enter image description here

As you can see, it has the option because I write "tes", but if I click outside the dropdown:

enter image description here

I want to clean the dropdown if the user clicks outside the input. How can I do that?

0

There are 0 best solutions below