Skip to content

Instantly share code, notes, and snippets.

@Mattnmoore
Created October 22, 2018 17:15
Show Gist options
  • Select an option

  • Save Mattnmoore/2f325d7f044d727c8e54fd57103823db to your computer and use it in GitHub Desktop.

Select an option

Save Mattnmoore/2f325d7f044d727c8e54fd57103823db to your computer and use it in GitHub Desktop.
Angular Component Focus
<ng-select #websiteSelect
[items]="selectWebsites$ | async"
formControlName="website"
placeholder="Select a website"
bindLabel="name"
labelForId="website">
</ng-select>
@ViewChild('websiteSelect') websiteSelect;
public toggleForm() {
setTimeout(() => {
this.mySelect.focus();
});
}
@driftfox
Copy link

driftfox commented May 24, 2019

I think this.mySelect should be this.websiteSelect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment