I have several ng-selects on a page, and am trying to open one from ts.
I am able to focus on the right ng-select using the following:
@ViewChildren(NgSelectComponent) ngselect: QueryList<NgSelectComponent>;
this.ngselect.last.filterInput.nativeElement.focus()
However, I'm not able to open. I tried the below
this.ngselect.last.filterInput.nativeElement.open()
but get the error:
_this.ngselect.last.filterInput.nativeElement.open is not a function
.open() is a method though...how can I get this to work? https://github.com/ng-select/ng-select#methods
Have You tried something like this
<ng-select #Selecter ></ng-select>
@ViewChild('Selecter') ngselect: NgSelectComponent;
ngAfterViewInit() {
this.ngselect.open();
}
Working Example Links To stackblitz