ng-blur

Handler for blur event

Description

The ng-blur directive allows you to specify custom behavior when an element loses focus.

Parameters


ng-blur

  • Type: Expression

  • Description: Expression to evaluate upon blur event. FocusEvent object is available as $event.

  • Example:

    <div ng-blur="$ctrl.handleBlur($event)"></div>
    

Demo

<section ng-app>
  <input
    type="text"
    ng-blur="count = count + 1"
    ng-init="count = 0"
    placeholder="Click or tab away from me"
  />
  Lost focus {{ count }} times
</section>
Lost focus {{ count }} times