Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
angularjs获取onclick上的焦点元素_Angularjs - Fatal编程技术网

angularjs获取onclick上的焦点元素

angularjs获取onclick上的焦点元素,angularjs,Angularjs,单击按钮事件如何在我的表单上找到以光标为焦点的输入元素。 我的表单上有多个输入,希望将onclick上的一些数据与焦点元素绑定 HTML: 使用ng单击(为什么在模板中有onclick?)和依赖项注入$event,它将允许您在控制器中访问它 <div> <button onclick="findFocus"></button> <input type="text" id="name" /> <input type="text" id="e

单击按钮事件如何在我的表单上找到以光标为焦点的输入元素。 我的表单上有多个输入,希望将onclick上的一些数据与焦点元素绑定

HTML:


使用
ng单击
(为什么在模板中有
onclick
?)和依赖项注入
$event
,它将允许您在控制器中访问它

<div>
<button onclick="findFocus"></button>

<input type="text" id="name" />
<input type="text" id="email" />
<input type="text" id="address" />
</div>