1

Im using the NbAutocomplete Module of Nebular and i added a button to clear the value.
The value is cleared and after that the drop down list won't open. No error in console.

Any idea?

Template

      <nb-form-field>
            <input #autoInputUser
              nbInput
              fullwidth
              formControlName="UserName"
              type="text"
              (input)="onChangeAutoUser()"
              placeholder="..."
              [nbAutocomplete]="autoUser" />

            <button nbSuffix nbButton (click)="reset()">
              <nb-icon [icon]="'close-outline'"
                pack="eva">
              </nb-icon>
            </button>

            <nb-autocomplete #autoUser
              (selectedChange)="onSelectionChangeUser($event)">
              <nb-option *ngFor="let option of filteredADUsers"
                [value]="option.fullName">
                {{ option.fullName }}
              </nb-option>
            </nb-autocomplete>
          </nb-form-field>

Component

 ngOnInit(): void {

this.form = this.fb.group({
  GroupId: ['', Validators.required],
  UserName: ['', Validators.required],
  Action: ['', Validators.required],
})
}
    @ViewChild('autoInputUser') inputUser : ElementRef;


   reset(){
   this.inputUser.nativeElement.value = ''; // Clear the input - After that the DD won't open
   this.form.get('UserName').reset(); // This for rest form - This reset the form value but not reset the input
 }
user384496
  • 180
  • 1
  • 2
  • 16

0 Answers0