Ng-click fires before ng-blur


#1

I have a text box and a button inside an ion-item. I’m handling ng-blur on the text box to do some processing. What I notice is that when I click on the button (handled by ng-click) while the text box is still in focus, the click event fires before blur. It’s causing me problem because in the click event I’m using the result of the processing done in blur event handler.

In just Angular (and in plain JS), the blur always fires before click, as expected. In Ionic if I enclose the contents of ng-click event handler in a $timeout, it executes after ng-blur, but I feel it’s just a hack.

Why is Ionic behaving differently and what should I do to make the events fire in the right order?

Here’s a codepen of events firing in the right order in Angular: https://codepen.io/shridhi/pen/wojxbe
Here’s a codepen of events firing out of order in Ionic: https://codepen.io/shridhi/pen/ENLpBJ