angularjs How to set focus on input field?

前端之家收集整理的这篇文章主要介绍了angularjs How to set focus on input field?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

本文转自:http://stackoverflow.com/questions/14833326/how-to-set-focus-on-input-field,未作修改


What is the 'Angular way' to set focus on input field in AngularJS?

More specific requirements:

  1. When aModalis opened,set focus on a predefined<input>inside this Modal.
  2. Everytime<input>becomes visible (e.g. by clicking some button),set focus on it.

I tried to achieve the first requirementwithautofocus,but this works only when the Modal is opened for the first time,and only in certain browsers (e.g. in Firefox it doesn't work).

Any help will be appreciated.

原文链接:https://www.f2er.com/angularjs/149713.html

猜你在找的Angularjs相关文章