Skip to content

Commit 1fc15d7

Browse files
author
igor.nepipenko
committed
fix(ref:1560): fix issue
1 parent 398681d commit 1fc15d7

File tree

4 files changed

+1605
-0
lines changed

4 files changed

+1605
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### fix
44

55
- Fix ([#1585](https://github.com/JsDaddy/ngx-mask/issues/1585))
6+
- Fix ([#1560](https://github.com/JsDaddy/ngx-mask/issues/1560))
67

78
# 21.0.0(2026-01-28)
89

projects/ngx-mask-lib/src/lib/ngx-mask.directive.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,11 +1046,20 @@ export class NgxMaskDirective
10461046
.replace(MaskExpression.DOT, MaskExpression.COMMA);
10471047
}
10481048
if (this.mask()?.startsWith(MaskExpression.SEPARATOR) && this.leadZero()) {
1049+
const isFirstWrite = !this._maskService.isInitialized;
10491050
requestAnimationFrame(() => {
1051+
// On initial load, temporarily set isInitialized to false
1052+
// so formControlResult returns early and doesn't mark form as dirty
1053+
if (isFirstWrite) {
1054+
this._maskService.isInitialized = false;
1055+
}
10501056
this._maskService.applyMask(
10511057
inputValue?.toString() ?? '',
10521058
this._maskService.maskExpression
10531059
);
1060+
if (isFirstWrite) {
1061+
this._maskService.isInitialized = true;
1062+
}
10541063
});
10551064
}
10561065
this._maskService.isNumberValue = true;

0 commit comments

Comments
 (0)