[英]maxlength not working for Input box
我正在使用以下語法,
<span ng-repeat="item in basicProductInformation.productName">
<input ng-show="currentLoggedInCompanyId == '566019bbb356de9283ded176'" ng-class="{errElementBorder: item.valueErr && !item.value}" class="form-control input-sm" type="text" ng-model="item.value" maxlength="500" ng-readonly="ValuesReadOnly" style="height: 34px;">
<input ng-hide="currentLoggedInCompanyId == '566019bbb356de9283ded176'" ng-class="{errElementBorder: item.valueErr && !item.value}" class="form-control input-sm" type="text" ng-model="item.value" maxlength="80" ng-readonly="ValuesReadOnly" style="height: 34px;">
</span>
保存更改后,它總是采用maxlength 80,對於第一個ng-show條件,UI上將不會顯示任何內容
對於第二個輸入框(ng-hide),文本將被正確保存並正確顯示在UI上
如果我做錯了什么,請提出建議?
嘗試使用ng-maxlength。 這是AngularJS文檔ngMaxlength 。
然后在您的條件語句中,嘗試使用“ ===”而不是“ ==”。 兩者之間的比較有所不同,因為'=='使用類型轉換。 閱讀此主題 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.