Answer the question
In order to leave comments, you need to log in
Angular 1.6.4 $watchGroup returns empty strings for old values. I don't understand what's wrong?
Actually, all the old values are returned empty and I can’t find out what happened before (pasting into the input form fields is performed from the clipboard):
However, after a while after several changes in the fields in manual mode (by pressing keys on the keyboard), everything returns to normal and the old values are already specified normally.
If I enter everything manually at once, without using the clipboard, then everything seems to be normal.
$watchCollection gives correct results. Here all the old values are specified correctly.
??? There are absolutely no ideas what is wrong.
Answer the question
In order to leave comments, you need to log in
I recommend that you abandon $watchGroup and $watch, instead add ng-change to the inputs, and do whatever you want in the handler functions.
Reasons:
1) Full control of the process
2) No performance loss due to watch'ers
What for in principle watchCollection? Do you have ng-model there? Use ng-change. Well, all sorts of convenient buns for working with forms, since angular is fine with this.
Well, the problem is not in the watchCollection, I threw in the minimum option here - everything works:
plnkr.co/edit/YOaCVdKyav5Q9OuXxY8B?p=preview
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question