Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 角度ngx掩码-值未格式化_Angular_Ngx Mask - Fatal编程技术网

Angular 角度ngx掩码-值未格式化

Angular 角度ngx掩码-值未格式化,angular,ngx-mask,Angular,Ngx Mask,我正在使用这个库,我试图用被动形式屏蔽Angular 11中的一些字段(日期和电话号码)。 下面是我的代码中的两个片段 <input type="text" class="form-control" mask="d0/M0/0000" [leadZeroDateTime]="true" [showMaskTyped]="true" required formControlName="

我正在使用这个库,我试图用被动形式屏蔽Angular 11中的一些字段(日期和电话号码)。 下面是我的代码中的两个片段

<input type="text" class="form-control" mask="d0/M0/0000" [leadZeroDateTime]="true" [showMaskTyped]="true" required formControlName="dateOfBirth" />
<input type="text" class="form-control" id="mobile-phone" mask="0000-0000" [showMaskTyped]="true" required formControlName="mobilePhone" />
这就是它在UI中的显示方式

但这是我访问这些值时的结果


知道我做错了什么吗

再添加一个掩码选项,即
dropSpecialCharacters
,如下所示:

<input type="text" class="form-control" id="mobile-phone" mask="0000-0000" [showMaskTyped]="true" required formControlName="mobilePhone" [dropSpecialCharacters]="false" />

请核实。。。您可以参考ngx掩码文档中的其他信息:

<input type="text" class="form-control" id="mobile-phone" mask="0000-0000" [showMaskTyped]="true" required formControlName="mobilePhone" [dropSpecialCharacters]="false" />