Angular 4 文本框自動獲取焦點二

Angular是不推薦直接經過DOM操做獲取元素的,要操做元素就經過@ViewChild裝飾器。segmentfault 在HTML中對元素添加引用myInput:bash <input type="text" #myInput> 在ts中能夠經過ViewChild獲取指定元素的引用:ui import { ViewChild } from '@angular/core'; @ViewChild
相關文章
相關標籤/搜索