primeng:将重点放在控制上 [英] primeng: Setting focus on control

查看:70
本文介绍了primeng:将重点放在控制上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉出现菜鸟问题...

sorry for the noob question...

在使用primeng包时,建议将焦点放在控件上的方法是什么?使用传统的输入控件时,我设置了一个表单变量(#variable),并使用@ViewChild对其进行引用,以便可以访问其本机元素:

what's the recommended way of setting the focus on a control when using the primeng pack? When using a traditional input control, I set up a form variable (#variable) and use the @ViewChild to get a reference to it so that I can access its native element:

this._variable.nativeElement.focus();

使用primeng的控件之一时该怎么做?

How can I do the same when using one of primeng's controls?

谢谢.

路易斯

推荐答案

我使用了autofocus关键字:

I use the autofocus keyword:

<input type="text" size="15" pInputText class="form-control"
       formControlName="email" autofocus/>

这篇关于primeng:将重点放在控制上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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