[英]whitespace in angular 4
Pattern that doesn't allow whitespace at the begining. 一开始不允许使用空格的模式。 Please find the code below : 请在下面找到代码:
<input class="mdl-textfield__input inputMaterial" maxlength="100"
[(ngModel)]="getEmpName[i]" (keydown)="onKeyPress($event)" pattern="[a-zA-Z
]*" appFloatLabelDirective="" formControlName="employer_name">
You can take a look at the angular input-mask
plugin for this kind of problem : https://github.com/assisrafael/angular-input-masks 您可以看一下针对此类问题的angular input-mask
插件: https : //github.com/assisrafael/angular-input-masks
It allows you to filter inputs, and create custom directives 它允许您过滤输入,并创建自定义指令
^ [^-\\ s] [\\ w \\ s-] + $-这种模式帮助了我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.