使用Angular2时如何在输入类型中实现管道? [英] How to implement pipe in a input type while using Angular2?

查看:60
本文介绍了使用Angular2时如何在输入类型中实现管道?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是angularJS2的新手,我正在尝试在表单的输入类型文本中实现管道.例如,如果我有一个像这样的输入标签

I am new to angularJS2 and I am trying to implement pipe in the input type text of a form. For instance if I have a input tag like this

  <input type="text" class="col-lg-7 small rounded form-control" formControlName="firstName" />

我希望在文本字段中输入的值全部为大写,是否可以在表单的输入元素中实现?

I want the value entered in the text field to be all uppercase, can we achieve this inside a input element of a form?

推荐答案

无法在输入上使用管道.

It's not possible to use pipes on inputs.

但是,您可以在输入法中运行管道.

You can however run your pipe within an input method.

this.toUpper = new UpperCasePipe().transform(input);

希望有帮助

这篇关于使用Angular2时如何在输入类型中实现管道?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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