Something happened between AngularJS 1.2 and 1.6 to reverse the order that ng-click
and ng-change
fire in.
I've made a plunk to illustrate it: http://plnkr.co/edit/XgbgLSuP1znhWszeyiHd?p=preview
The default for this page is to use Angular 1.2.28
. In this case, if you change the radio buttons in the example, you'll see the click event fires before the change event.
If you then switch the comments so that Angular 1.6.10 is used, you'll see the change event now fires before the click event.
What happened in the development of AngularJS to cause this, and is there any way to retain the former behaviour while using a more up to date version of AngularJS?
Thanks very much for any help you can give!
EDIT: I should probably say why this is important. I want to be able to inspect the value of the variable before it changes, in order to see whether the change should be allowed. I was able to do this using ng-click
on AngularJS 1.2, but because ng-change
is fired first on AngularJS 1.6, the change has already been made before I can decide whether it should go ahead. If you have other ideas as to how I can accomplish this with AngularJS 1.6, I'd be very interested to hear them.
priority
order of these directives. They both should havepriority: 0
, so one is calling before another just because of how they were structured in code. – Fishmongerng-disabled
to disable disallowed choices. – Remission