【发布时间】:2016-11-19 11:06:12
【问题描述】:
我的最终目标是让 textarea 元素自动专注于创建。我刚刚想到了在事件onload 上调用e.target.focus() 的解决方案。比如:
<textarea rows="8" col="60" (load)='handleLoad($event)'>
然后:
handleLoad(e){
e.target.focus();
}
问题是 Angular 无法识别 load 事件。
PS:我试过autofocus 一次,但似乎不起作用。
【问题讨论】:
-
textarea没有这样的事件,但是如果angular2中存在同样的事件,你可以使用ng-include的onload
-
我也在寻找同样的东西,但没有运气。
标签: javascript html angular