<!DOCTYPE html>
<html lang="zh_CN">
 <head>
  <title>字数小例子</title>
 </head>
 <body ng-app="noCntAPP">
  <div ng-controller="noCntCtrl">
    <h2>我的笔记</h2>
    <textarea cols="30" rows="10" ng-model="txtArea"></textarea>
    
    <p><button>读取</button>
    <button>提交</button>
    <button>撤销</button> 
    <p>剩余字数: {{getCount()}}</p>
    </p>
  <div>
  <script type="text/javascript" src="./angular.js"></script>
  <script type="text/javascript">
    angular.module('noCntAPP',[])
           .controller('noCntCtrl',['$scope',function($scope){
                $scope.txtArea=''; // 初始化文本区域值为空串
                $scope.getCount=function(){
                   return 100 - $scope.txtArea.length;
                }
          }]);
  </script>
 </body>
</html>
剩余字数小例子

相关文章:

  • 2022-12-23
  • 2021-08-15
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
  • 2021-04-03
  • 2021-12-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2021-06-24
  • 2021-11-29
相关资源
相似解决方案