發表文章

Using ngx-mask module to mask

 When I want to define masks in inputs, I'll import ngx-mask module in my Angular app. 1. To limit how many decimals to the end of my input, we apply  separator  mask with dot. mask =" separator.2 " 2. To divide our input by thousands, we will separate with a comma. thousandSeparator =" , " 3. To limit the number of digits before the decimal point, we should set  separatorLimit  value. separatorLimit =" 1000 " To  block user from keyboard when entering more than 4 digits before the decimal point. 4. Example <input mask="separator.2" thousandSeparator="," separatorLimit="1000" />