cesarrew / ng2-currency-mask

A very simple currency mask directive that allows using a number attribute with the ngModel.
MIT License
234 stars 116 forks source link

Library not working with reactive forms #106 #148

Closed albertzubkowicz closed 2 years ago

albertzubkowicz commented 4 years ago

Hi there, I'm trying to use your library, exactly as stated in docs, with reactive forms, but it doesn't seem to work at all, it works only with ngModel, which is deprecated for years already and doesn't work together with reactive forms. Can you have a look?

at my form component: public salvageForm = new FormGroup({ salvageAmount: new FormControl() });

and the template:

{{ "customerSalvage.salvageAmount" | columnName }} package.json: "dependencies": { "@angular/animations": "^8.2.14", "@angular/cdk": "^8.2.3", "@angular/common": "^8.2.14", "@angular/compiler": "^8.2.14", "@angular/core": "^8.2.14", "@angular/forms": "^8.2.14", "@angular/platform-browser": "^8.2.14", "@angular/platform-browser-dynamic": "^8.2.14", "@angular/router": "^8.2.14", "@ng-bootstrap/ng-bootstrap": "5.1.5", "@swimlane/ngx-charts": "13.0.1", "bootstrap": "4.4.1", "classlist.js": "^1.1.20150312", "core-js": "^3.6.5", "moment": "^2.25.3", "moment-range": "^4.0.2", "ngx-currency": "^2.3.3", "rxjs": "^6.5.5", "tslib": "^1.13.0", "web-animations-js": "^2.3.2", "zone.js": "~0.10.2" }, app module is exactly as in docs, with global config.

does ahead of time compilation matter? This library is crucial for me, so I will appreciate any help

cesarrew commented 2 years ago

Hello. The following example uses the library with reactive forms.

https://github.com/cesarrew/ng2-currency-mask/tree/master/projects/library-test

cesarrew commented 2 years ago

Another option: https://stackblitz.com/edit/angular-ivy-bpn8by