最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Ngx-mask Enforcing Validation on Input fields in production - Stack Overflow

programmeradmin3浏览0评论

My Input looks like this: I just want to use input mask but not enforce the user to strictly fill the pattern in the mask.

<input type="text" class="Enter Zipcode" placeholder="Enter Zipcode" mask="00000-0000" formControlName="zipcode">

Seems like according to documentation [validation]=true by default. But should be some way to change validation to false. When I do it

<input type="text" class="Enter Zipcode" placeholder="Enter Zipcode" mask="00000-0000" formControlName="zipcode" [validation]="true">

ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'validation' since it isn't a known property of 'input'. ("text" class="Enter Zipcode" placeholder="Enter Zipcode" mask="00000-0000" formControlName="zipcode" [ERROR ->][validation]="false">

Angular throws template parse errors ?

My Input looks like this: I just want to use input mask but not enforce the user to strictly fill the pattern in the mask.

<input type="text" class="Enter Zipcode" placeholder="Enter Zipcode" mask="00000-0000" formControlName="zipcode">

Seems like according to documentation [validation]=true by default. But should be some way to change validation to false. When I do it

<input type="text" class="Enter Zipcode" placeholder="Enter Zipcode" mask="00000-0000" formControlName="zipcode" [validation]="true">

ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'validation' since it isn't a known property of 'input'. ("text" class="Enter Zipcode" placeholder="Enter Zipcode" mask="00000-0000" formControlName="zipcode" [ERROR ->][validation]="false">

Angular throws template parse errors ?

Share Improve this question asked Apr 2, 2019 at 3:56 GURURAJ DHARANIGURURAJ DHARANI 4681 gold badge6 silver badges14 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

Use mask="99999-9999". According to ngx-mask documentation the 0's are used for required numeric fields and the 9's for optional numeric fields.

发布评论

评论列表(0)

  1. 暂无评论