search

Home  >  Q&A  >  body text

angular.js input data box turns red when input is correct

Image description

我想大声告诉你我想大声告诉你2846 days ago650

reply all(4)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-15 17:14:08

    You'd better submit the sample code online and run it. No problem can be seen from the code you provide now

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-15 17:14:08

    试试,ng-min ng-max

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-15 17:14:08

    You can set the corresponding style if the form verification succeeds or fails, http://blog.csdn.net/u0111270...

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-15 17:14:08

    In fact, you can put the input box in one <form></form> 里面,然后给 form 添加一个 name 属性:<form name="myForm"></form>。输入框给一个 ng-model,比如叫 size

    By doing this, you can call myForm.size.$valid 来判断是否通过验证。类似的,你也可以从 myForm.size.$error this Object in HTML in real time to get more detailed error information

    Use this to dynamically add class 就好,用 ng-class

    to the input box

    reply
    0
  • Cancelreply