How can I force ng-click to take precedence over an ng-blur event?

Instead of ng-click, use ng-mousedown. Mousedown events get fired before blur events.

However, the handled mousedown might un-focus your field without the blur event being fired.
If you then click outside the box, the blur event won’t be fired (because the field is already blurred), so after setting focus, you might need to re-focus the field manually – see
How to set focus on input field?

Note that by using this approach, the button can also be triggered using right-click (thanks Alexandros Vellis!) as you can see in this official example.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)