A
A
Artur Bekerov2014-01-22 17:53:17
JavaScript
Artur Bekerov, 2014-01-22 17:53:17

Is there some way to hang a function when the input loses focus (tab pressed while filling the button, or clicked somewhere else)?

Hey!
Tell me if there is some way to hang a function when the input loses focus (pressed tab when filling the button, or clicked somewhere else).

Preferably without jquery.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-01-22
@krekerov

docs.angularjs.org/api/ng.directive:ngBlur

I
itspers, 2014-01-22
@itspers

.directive('ng-blur', function() {
        return {
            restrict: 'A',
            link: function postLink(scope, element, attrs) {
                element.bind('blur', function () {
                    scope.$apply(attrs.ngBlur);
                });
            }
        };
    });

$scope.handleInputBlur = function(){
   // do some action here
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question