将默认焦点放在AngularJS中的元素上的最简单方法是什么? [英] What is the easiest way to put a default focus on an element in AngularJS?

查看:79
本文介绍了将默认焦点放在AngularJS中的元素上的最简单方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个模态对话框中加载的模板,上面有一个我想重点介绍的输入文本.最简单,最有角度的方法是什么?

I have a template that is loaded in a modal dialog, there is a single input text on it which I would like to have a focus on. What is the easiest and the Angular way of doing that?

更新:

如何在输入字段上设置焦点?

推荐答案

根据需要支持的浏览器,可以使用

Depending on the browser(s) you need to support you could use input autofocus attribute.

此处中查看plunker.

See plunker here.

或者,如果这不是一个选项并且由Mark提到,则可以参考以下

Or if this is not an option and has mentioned by Mark you can refer to the following stackoverflow response.

这篇关于将默认焦点放在AngularJS中的元素上的最简单方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆