JsDaddy / ngx-mask

Angular Plugin to make masks on form fields and html elements.
https://jsdaddy.github.io/ngx-mask
MIT License
1.15k stars 299 forks source link

From 13.1.10 (even 14.x) initial value is not being displayed in input file #1042

Closed guillermodelagala closed 1 year ago

guillermodelagala commented 1 year ago

🐞 bug report

Is this a regression?

Yes, the previous version in which this bug was not present was: 13.1.9

Description

Having the following input with an initial value of: 5.000,000 , the input displays the placeholder instead of the value. <input class="input" type="text" formControlName="quantity" [placeholder]="getNumberPlaceholder()" mask="separator.3" [decimalMarker]="getDecimalMarker()" [thousandSeparator]="getThousandSeparator()" [dropSpecialCharacters]="false" [matTooltip]="form.controls.quantity.value" matTooltipPosition="above" [ngClass]="{ 'has-error': form.controls.quantity.errors }" />

🔬 Minimal Reproduction

I can't create a reproduction. At the moment I'll work with version 13.1.9, but please investigate the changes you did between 13.1.9 and 13.1.10. I'm working with Angular 14.2.4.

Angular Version:

14.2.4

npm run ng version

> lbh-pa@1.0.4 ng
> ng

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 14.2.4
Node: 16.17.0
Package Manager: npm 8.15.0
@angular-devkit/build-angular   14.2.4
@angular-devkit/core            14.2.4
@angular-devkit/schematics      14.2.4
@angular/cdk                    14.2.3
@angular/google-maps            14.2.3
@angular/material               14.2.3
@schematics/angular             14.2.4
rxjs                            7.5.7
typescript                      4.7.4

Programista1k commented 1 year ago

Hey! Import FormsModule, and add [(ngModel)]="value" to your input, it should work just fine!

foerstj-dv commented 1 year ago

Hi! I have the same issue. And I have FormsModule imported & [(ngModule)] defined. There's an initialization issue that appears with the 13.1.10 update. It might be related to locale (German here). Stackblitz demo: https://stackblitz.com/edit/angular-opspqb?file=src/app/app.component.html We decided to migrate away from ngx-mask because of this.

Maximaximum commented 1 year ago

Same for me, reproduces in my project. Since it's quite a critical issue, I'm considering moving away from ngx-mask as well.

Maximaximum commented 1 year ago

Also, this seems to be a duplicate of https://github.com/JsDaddy/ngx-mask/issues/1042

guillermodelagala commented 1 year ago

Also, this seems to be a duplicate of #1042

this is 1042 XD

andriikamaldinov1 commented 1 year ago

@guillermodelagala Thanks for your using Ngx-Mask. Please update to latest version. It example, all work as expected - https://stackblitz.com/edit/angular-7uobnu?file=src%2Fmain.ts In the future we are considering support Angular version 15,14

guillermodelagala commented 1 year ago

Thanks for fixing. At the moment I'm using Angular 15, so please notify me when the dependency is compatible again with the latest Angular version. Regards.