Search code examples
javascriptangularjsvalidationtextangular

How to apply max word count validation on text-angular


The below code is for character validation. Now I want same type of validation for maximum word.

<text-angular ta-toolbar="[['undo','redo'], ['bold','italics','underline'], ['justifyLeft','justifyCenter','justifyRight','justifyFull'], ['wordcount']]" ng-model="description" name = "desc" ta-max-text="20" ></text-angular><br />

<span ng-show="form.desc.$error.taMaxText">Input is too long!</span>

In other words I want an alternative of "ta-max-text" for max words. Any inbuilt or custom validator for same ?


Solution

  • As you've done with "taMaxText", you must build your own directive or just use one someone already made...