时间:2021-07-01 10:21:17 帮助过:10人阅读
<!DOCTYPE html> <html ng-app="formExample"> <head> <meta charset="UTF-8"> <title></title> <script src="../js/angular.js"></script> <script> angular.module('formExample', []) .controller('FormController', ['$scope', function($scope) { $scope.userType = 'guest'; $scope.change = false; }]); </script> </head> <body> <form name="myForm" ng-controller="FormController"> userType: <input name="input" ng-model="userType" ng-blur="change=true" ng-focus="change=false" required> <span class="error" ng-show="myForm.input.$error.required && change">必填项</span><br> </form> </body> </html>
相信看了本文案例你已经掌握了方法,更多精彩请关注Gxl网其它相关文章!
推荐阅读:
BootStrap标题怎么设置禁止跨行
js控制时间每秒自己运动
parabola.js实现抛物线与加入购物车功能
以上就是AngularJS获取焦点以及操作焦点的详细内容,更多请关注Gxl网其它相关文章!