25

In AngularJS, I can use the ng-focus directive to know when I have the focus of an input field, but what about when I lose the focus?

Is there any directive for that?

2
  • 10
    Lose focus == blur, so ngBlur. Apr 25, 2014 at 10:41
  • @zeroflagL Ah I wasn't aware that was what blur meant, thanks, you could probably put that as an answer for the record
    – JMK
    Apr 25, 2014 at 10:43

1 Answer 1

45

The opposite of the focus event is the blur event. It's fired when an element loses its focus. So what you are looking for is the ngBlur directive.

2
  • 2
    lose focus and blur are two different things, on page load most of the text boxes will be on blur and the provided event for that will get triggered on the page load also if i am right. Jan 16, 2015 at 7:23
  • 2
    @irfanshafi I think you confuse blurred with inactive. Jan 16, 2015 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.