Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with reactive forms #2

Closed
stepet80 opened this issue Mar 25, 2019 · 6 comments
Closed

issue with reactive forms #2

stepet80 opened this issue Mar 25, 2019 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@stepet80
Copy link

stepet80 commented Mar 25, 2019

Hello,

We are using this control with reactive forms (formControlName). We create a form and pass a value with the form control. Whenever we want to adapt the value through reactive forms by changing the value outside the user interface it doesn't seem to work. Could it be that there is still a problem with reactive forms?

In the code I can see that writeValue receives an object, but nothing is done with it...

writeValue(obj: any): void { if (this.instance) { this.internal = this.instance.getFormatted(); } }

Kind regards,
Peters Stephan

@ainouss
Copy link
Contributor

ainouss commented Mar 27, 2019

Hello,
Thanks for reporting this issue.

Yes, writeValue could be better implemented. I'll see how to resolve this in future. I suggest you to to create an alias for the autonumeric instance in HTML and use the instance to update (visually) the value by using instance.set(myNewValue).
I implemented a quick example in the planker bellow.

https://stackblitz.com/edit/ng-autonumeric-reactive-forms
Kind regards,

Abdelghani Ainouss

@stepet80
Copy link
Author

Can you implement it in your library quicker ? The reason is that I work for a company with multiple teams and we want to implement this everywhere. I would like not to have to do that trick in every team :) We are talking about dozens of applications.

@ainouss
Copy link
Contributor

ainouss commented Apr 17, 2019

Hello Stephan,
I will work on the issue for the next release :). I was in a vacation and did not have time to update it. If you have any suggestion please feel free to send a merge request. Glad to know that it helps.
Kind regards,
Abdelghani.

@ainouss ainouss added enhancement New feature or request help wanted Extra attention is needed labels Apr 17, 2019
@stepet80
Copy link
Author

Ok thanks. No we don't have a suggestion for now.

@ainouss
Copy link
Contributor

ainouss commented Sep 3, 2019

Support for reactive forms has been added, please upgrade to v 2.0.0

@ainouss ainouss closed this as completed Sep 3, 2019
@Davide-a11y
Copy link

Hello!

With Angular 8.3.19 we encounter a problem when we try to dynamically update the value of the autonumeric field linked to a formcontrol field ( or linked to an ngModel ). You can see in this example https://stackblitz.com/edit/angular-wwld1p that in the ngOnInit the value is correctly setted, but in the onReset is not working properly: on the HTML element the value is setted, but if we print in the console the object, the value of the field is not changed...

Thanks!
Davide e Fabrizio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants