加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs How to set focus on input field?

发布时间:2020-12-17 10:34:54 所属栏目:安全 来源:网络整理
导读:本文转自: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: When aModalis opened,set focus on a predefine

本文转自: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.

Update 7/2013: I've seen a few people use my original isolate scope directives and then have problems with embedded input fields (i.e.,'@' was sufficient. Also note that when using '@' we compare the trigger value to "true" since @ always results in a string.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读