gpt4 book ai didi

javascript - Ngx-mask 在生产中对输入字段强制验证

转载 作者:行者123 更新时间:2023-11-29 15:58:52 25 4
gpt4 key购买 nike

我的输入是这样的:我只想使用输入掩码,但不强制用户严格填写掩码中的图案。

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

似乎根据 documentation [验证] 默认为真。但是应该通过某种方式将验证更改为 false。当我这样做的时候

<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 抛出模板解析错误?

最佳答案

使用 mask="99999-9999"。根据 ngx-mask 文档,0 用于必填数字字段,9 用于可选数字字段。

关于javascript - Ngx-mask 在生产中对输入字段强制验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55466737/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com