Angular 4 文本框自动获取焦点二

Angular是不推荐直接经过DOM操做获取元素的,要操做元素就经过@ViewChild装饰器。segmentfault 在HTML中对元素添加引用myInput:bash <input type="text" #myInput> 在ts中能够经过ViewChild获取指定元素的引用:ui import { ViewChild } from '@angular/core'; @ViewChild
相关文章
相关标签/搜索