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
You'd better submit the sample code online and run it. No problem can be seen from the code you provide now
试试,ng-min ng-max
You can set the corresponding style if the form verification succeeds or fails, http://blog.csdn.net/u0111270...
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 informationUse this to dynamically add
to the input boxclass
就好,用ng-class