0

I-m looking for a method for input fields which triggers on change, but which triggers after the model update. The reason why I'm looking for this method is I have a rather complex web-page with many input fields that influence each other. And having a $watchGroup method and ng-change methods for each input which only sets flags if the user changed input on a field is not the best way to organize code. And I would really prefer a method like ng-change that triggers after model update, so that the flow of the code would be much clearer.

Does such a method even exists?

Regards, AK

ak7483
  • 187
  • 1
  • 14
  • Yep - `ng-change` is triggered after an update, you can send the model as a parameter to the function it invokes, and you don't need a `$watch` with it. – Ori Drori Oct 01 '15 at 19:21
  • Sorry, but that is not the case. I have tested it and ng-change triggers before update. – ak7483 Oct 01 '15 at 19:25
  • @ak7483 - it triggers after... do you have a plunkr where this isn't the case? – tymeJV Oct 01 '15 at 19:27
  • Unfortunately I have the code at work, and I'm not sure if I can share it. But I will try to create plunkr example tomorrow when I'm in office tomorrow. – ak7483 Oct 01 '15 at 19:30
  • @ak7483 does this solve your problem? http://stackoverflow.com/questions/20101697/angularjs-why-is-ng-change-called-before-the-model-is-updated – Carl Ambroselli Nov 10 '15 at 09:46
  • I did solve this problem, however it created a few new ones. On the end I just solved the problem by calling callback withing the timeout function. – ak7483 Nov 15 '15 at 18:43

0 Answers0