我的textarea字段需要对字符进行计数,以显示相对于定义的最大长度剩余的字符数。 但是,当用户输入空格/换行符或从别处粘贴文本时,计数出错。angular.js textarea字符计数以排除计数空格和换行
我需要知道角度是否有任何指令或方法来支持排除空格/换行符的计数。
<textarea class="form-control" maxlength="{{desc}}" my-maxlength = "{{desc}}" maxlen="maxlen" type="text" ng-model="problem.DESCRIPTION" aria-describedby="qDesc" id="questionDescription" name="questionDescription" ng-required="caseType" lang-check></textarea>
<p ng-show="problem.DESCRIPTION.length > (desc-5)" class="text-danger pull-right" id="qDesc">{{ desc - problem.DESCRIPTION.length}} {{ resource["textcount.sublabel.maximumcharacters"] }</p>
我不明白这是怎么回事,以帮助OP为* “支持的空间排斥/换行符计” * – Phil