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.

相关文章

ANGULAR.JS:NG-SELECTANDNG-OPTIONSPS:其实看英文文档比看中...
AngularJS中使用Chart.js制折线图与饼图实例  Chart.js 是...
IE浏览器兼容性后续前言 继续尝试解决IE浏览器兼容性问题,...
Angular实现下拉菜单多选写这篇文章时,引用文章地址如下:h...
在AngularJS应用中集成科大讯飞语音输入功能前言 根据项目...
Angular数据更新不及时问题探讨前言 在修复控制角标正确变...