【问题标题】:Ngx-mask Enforcing Validation on Input fields in productionNgx-mask 对生产中的输入字段进行强制验证
【发布时间】:2019-04-02 03:56:01
【问题描述】:

我的输入看起来像这样:我只想使用输入掩码,但不强制用户严格填写掩码中的模式。

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

默认情况下似乎根据documentation [validation]=true。但应该是某种方式将验证更改为假。当我这样做时

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

【问题讨论】:

    标签: javascript angular7 input-mask


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-10-11
      • 2014-03-27
      • 2013-05-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-09
      相关资源
      最近更新 更多