search

Home  >  Q&A  >  body text

angular.js - angularjs如何获取表单textarea的value的length

angularjs如何获取表单textarea的value的length,想用这个length的长度来判断另一个p显示与否

<p ng-show="">文字长度大于1显示,否则隐藏</p>
<textarea ng-model="test" placeholder="输入文字"></textarea>
为情所困为情所困2744 days ago738

reply all(2)I'll reply

  • 世界只因有你

    世界只因有你2017-05-15 16:54:23

    You can judge the length directly through $scope.test拿到textareavalue,然后.length.

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-15 16:54:23

    ng-model has bound the value of textarea to the variable $scope.test, and directly determines the length of $scope.test

    reply
    0
  • Cancelreply