I’ve run into an issue with a select ng-model and ng-click. This occurs on devices and in emulators.
It appears that when you click a select and choose an option, then click a button that triggers an ng-click event without first closing the select the ng-click event occurs just before the ng-model update leaving things in an inconsistent state.
You can reproduce the issue with this pen:
- Click the select to open the options. Choose on option, but leave the select open.
- Click the ‘Click to Show Color’ button.
- The select closes (choosing the selected option). The alert indicates the state of the model at the time of the click (the old value), but you can see the select shows the updated value.
I can get it to behave correctly in the IOS simulator by wrapping the alert in a $timeout of a second, but on slower devices and in the Android emulator even this does not help.
Is there a better way to approach this? Any ideas? Thank you!