如何限制angularjs输入字段的长度

时间:2019-01-29 22:35:57

标签: html angularjs forms

我有以下代码,验证码字段只需要说10个字符。长度似乎是无限的。

我希望验证码的网页字段只说7个字符。

<div class=" col-sm-4 ">
<div id="myapp"  ng-controller="subscribe_controller">
<h4 style="color:black;" >Subscribe</h4>
<form id="subscribe_01">
<h4>
    <p ng-bind="msg2"></p>
    <input id="email2"   style="color:gray;" type="text" name="EMAIL" placeholder="Your Email Adddress" value="" ng-model="email2"></h4>
    <input id="token2"   class="w3-input w3-section"   type="hidden" name="token2"       value="<?php echo $token;?>" >
    <p>Code :<input id="captcha"     type="text"   placeholder="" required name="captcha" value="" ng-model="captcha" length="7" aw-limit-

length="3"><p>
    <button class="w3-button w3-black" ng-click="postData_subscribe()" id="buttoncontact_subscribe">Send To Subscribe</button></p>
</form>
</div

>

1 个答案:

答案 0 :(得分:0)

我是size选项,所以ng-min ng-max等。但这是旧尺寸