question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When I use mask="delimiter.2" and delimiter="." default shows with comma. Angular 13

See original GitHub issue

🐞 bug report

Description

I used a mask like this:

<input autocomplete="off" type="text" decimalMarker="." mask="separator.2">

add data via reactive forms:

    formControl.setValue(400.25);

πŸ”₯ Exception or Error

shows like this:


400.25 -> 400,2
255.43 -> 255,4

Also write text after the number will remove those numbers

🌍 Your Environment

Angular Version:


    "@angular/core": "^13.3.7",
    "@angular/forms": "^13.3.7",
    "ngx-mask": "^13.1.14",

Everything works fine in this version.

β€œngx-mask”: β€œ^12.0.0”

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

1reaction
StephaneVacommented, Nov 22, 2022

Hello,

Same report here with β€˜separator’, the following use case worked in v12 but fails in v13 & v14

When user’s browser language is in β€˜fr’ And angular component has public value = 1234.56; And angular template has :

input: <input mask="separator.2" [(ngModel)]="value"><br/>
pipe: {{value |Β mask:'separator.2'}}

Then browser should display:

input: 1 234.56
pipe: 1 234.56 

but since v13, the input value in browser is 1 234,56. The pipe is still OK.

It’s maybe due to https://github.com/JsDaddy/ngx-mask/blob/develop/projects/ngx-mask-lib/src/lib/mask.service.ts#L246 since in those browser Number(1234.56).toLocaleString('fullwide', {useGrouping: false, maximumFractionDigits: 20, }) returns "1234,56"

Should β€˜fullwide’ could be replaced by β€˜en-US’ instead, since Number(1234.56).toLocaleString('en-US', {useGrouping: false, maximumFractionDigits: 20, }) returns "1234.56" ?

1reaction
mrpiacommented, Dec 14, 2022

this fix might help, this was committed after the upgrade to angular 14

could someone please try to release a patch for angular 13 version?

UPDATE: commit doesn’t help

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using comma as a list separator in Angular 2 - Stack Overflow
I like Eric's answer better (see his comment for a sample Plunker): <span *ngFor="let item of items; let isLast=last"> {{item}}{{isLast ?
Read more >
JS Daddy ngx-mask Issues - Giters
JS Daddy ngx-mask: Angular Plugin to make masks on form fields and html ... When I use mask="delimiter.2" and delimiter="." default shows with...
Read more >
Decimal Pipe Comma Separator Example Arg - StackBlitz
Starter project for Angular apps that exports to the Angular CLI.
Read more >
Adding An ngRepeat List Delimiter In AngularJS
This Span tag took care of conditionally showing a list delimiter based ... delimiter is a dash, rather than the more commonly-used, "comma....
Read more >
How to Convert Comma Separated String to Array in Angular?
Here, i will show you how to works how to convert array into comma separated string in angular. you will learn convert string...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found