如何添加验证模式,不允许输入Angular2中仅包含空格? [英] How to add Validation pattern not to allow only space in input Angular2?
本文介绍了如何添加验证模式,不允许输入Angular2中仅包含空格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Angular2中使用了formBuilder,并希望添加验证模式以免输入中仅允许使用空格.
I used formBuilder in Angular2 and want to add validation pattern for not to allow "only spaces" in input.
推荐答案
使用以下内容:
Validators.pattern(/^\S*$/)
这篇关于如何添加验证模式,不允许输入Angular2中仅包含空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文