简体   繁体   English

ShowMaskOnFocus 不适用于 angular 中的输入掩码

[英]ShowMaskOnFocus not working for input-mask in angular

I am using input-mask library and wanted to implement masking for time format.我正在使用输入掩码库并想为时间格式实现掩码。 Which will accept integer numbers in HH:mm format so used this as below它将接受 HH:mm 格式的 integer 数字,因此如下使用

timeInputMask = createMask({
    mask: '[99:99]',
    showMaskOnFocus: true,
    showMaskOnHover:true
  });

<input maxlength="5" placeholder="__:__" [inputMask]="timeInputMask" />

After loading a textbox default masking is coming as " : " so its working fine.加载文本框后,默认掩码显示为“ : ”,因此工作正常。 Problem is - as soon as I click inside the textbox, the masking is hiding ie text box is blank.问题是 - 只要我在文本框内单击,掩码就会隐藏,即文本框是空白的。 After starts typing number the mask appears again.开始输入数字后,掩码再次出现。

Do you know how can we make masking visible on focus of he textbox?你知道我们怎样才能使遮罩在文本框的焦点上可见吗?

Here i use https://github.com/ngneat/input-mask library.这里我使用https://github.com/ngneat/input-mask库。

*.html *.html

<input maxlength="5" placeholder="HH:MM" [inputMask]="time" />

*.ts *.ts

time = createMask<Date>({
    alias:'datetime',
    inputFormat: 'HH:MM'
  });

Ref: https://stackblitz.com/edit/angular-ivy-sp6w7d?file=src%2Fapp%2Fapp.component.html参考: https://stackblitz.com/edit/angular-ivy-sp6w7d?file=src%2Fapp%2Fapp.component.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM