1
我有在其上我已經使用最大檢查的角JS一個文本字段。 其工作絕對好,但我想顯示錯誤跨度如果text.length達到最大長度。像NG-如果searchtext.length ==最大顯示使用角文檔的消息顯示錯誤味精當文本達到最大長度角JS
我有在其上我已經使用最大檢查的角JS一個文本字段。 其工作絕對好,但我想顯示錯誤跨度如果text.length達到最大長度。像NG-如果searchtext.length ==最大顯示使用角文檔的消息顯示錯誤味精當文本達到最大長度角JS
:最大長度 https://docs.angularjs.org/api/ng/directive/ngMaxlength
例應罰款爲您希望
<form name="myForm">
<input
type="text"
name="myText"
ng-model="myModel"
ng-maxlength="2">
<span ng-show="myForm.myText.$error.maxlength">Error</span>
</form>