search

Home  >  Q&A  >  body text

angular.js - How to get the length of the value of the form textarea in angularjs

How does angularjs get the length of the value of the form textarea? I want to use the length of this length to determine whether another p is displayed

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

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