最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

AngularJS實(shí)現(xiàn)的獲取焦點(diǎn)及失去焦點(diǎn)時(shí)的表單驗(yàn)證功能示例

 更新時(shí)間:2017年10月25日 10:22:57   作者:itsonglin  
這篇文章主要介紹了AngularJS實(shí)現(xiàn)的獲取焦點(diǎn)及失去焦點(diǎn)時(shí)的表單驗(yàn)證功能,涉及AngularJS使用ng-blur、ng-focus針對(duì)表單事件監(jiān)聽(tīng)相關(guān)操作技巧,需要的朋友可以參考下

本文實(shí)例講述了AngularJS實(shí)現(xiàn)的獲取焦點(diǎn)及失去焦點(diǎn)時(shí)的表單驗(yàn)證功能。分享給大家供大家參考,具體如下:

<!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">必填項(xiàng)</span><br>
</form>
</body>
</html>

運(yùn)行效果:

更多關(guān)于AngularJS相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《AngularJS指令操作技巧總結(jié)》、《AngularJS入門(mén)與進(jìn)階教程》及《AngularJS MVC架構(gòu)總結(jié)

希望本文所述對(duì)大家AngularJS程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論

盘锦市| 贞丰县| 东辽县| 临邑县| 开江县| 奉化市| 老河口市| 澄迈县| 临桂县| 云龙县| 汕尾市| 安阳市| 北票市| 泗洪县| 民勤县| 海门市| 民和| 桦川县| 修文县| 曲周县| 乃东县| 盈江县| 盱眙县| 马鞍山市| 胶南市| 东乌| 光山县| 榆树市| 江孜县| 吉林市| 开原市| 余姚市| 汝南县| 合山市| 青川县| 邵东县| 彭州市| 定南县| 莱芜市| 新邵县| 琼结县|