[AngularJS] Using an AngularJS directive to hide the keyboard on submit

Pleasea refer to Link

<form ng-submit="foo()" handle-phone-submit>
  <input type="text" ng-model="query" name="query" />
  <button type="submit">OK</button>
</form
angular.module('Foobar', [])
.directive('handlePhoneSubmit', function () {
    return function (scope, element, attr) {
        var textFields = $(element).children('input[type=text]');
         
        $(element).submit(function() {
            console.log('form was submitted');
            textFields.blur();
        document.acvtiveElement.blur();  }); }; });
原文地址:https://www.cnblogs.com/Answer1215/p/6043603.html