Skip to content

Instantly share code, notes, and snippets.

@Mayankgupta688
Created September 6, 2019 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mayankgupta688/703891c75a2d7ac5a569ddc1efe0ea76 to your computer and use it in GitHub Desktop.
Save Mayankgupta688/703891c75a2d7ac5a569ddc1efe0ea76 to your computer and use it in GitHub Desktop.
@Component({
selector: 'accessing-template-reference',
template: '<div><input type="text" #someElement />'
})
export class HeroListComponent implements OnInit {
@ViewChild("someElement") domReference;
ngAfterViewInit(): void {
this.domReference.nativeElement.focus();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment